Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Mar 2009 18:23:54 GMT
From:      Ulf Lilleengen <lulf@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 158590 for review
Message-ID:  <200903021823.n22INs3j024536@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=158590

Change 158590 by lulf@lulf_carrot on 2009/03/02 18:23:47

	- Return the complete physical address, not just the page. This fixes a
	  panic caused by busdma trying to convert the translated address into
	  the uncached P2 segment, but the conversion modified the physical
	  address, causing troubles when the memory was being used. This was
	  later detected by uma.
	- Return 0 in case the lookup is unsuccessful.
	- P1 and P2 segments are only accessible to kernel processes, so is only
	  handled in pmap_kextract.

Affected files ...

.. //depot/projects/avr32/src/sys/avr32/avr32/pmap.c#11 edit

Differences ...

==== //depot/projects/avr32/src/sys/avr32/avr32/pmap.c#11 (text+ko) ====

@@ -284,7 +284,14 @@
 vm_paddr_t
 pmap_kextract(vm_offset_t va)
 {
-	return pmap_extract(kernel_pmap, va);
+
+	/* Don't lookup in page tables for P1 and P2 segments. */
+	if ((va & AVR32_SEG_MASK) == AVR32_SEG_P1)
+		return (AVR32_P1_TO_PHYS(va));
+	else if ((va & AVR32_SEG_MASK) == AVR32_SEG_P2)
+		return (AVR32_P2_TO_PHYS(va));
+
+	return (pmap_extract(kernel_pmap, va));
 }
 
 /*
@@ -735,14 +742,10 @@
 {
 	pt_entry_t *ent;
 
-	/* Don't lookup in page tables for P1 and P2 segments. */
-	if ((va & AVR32_SEG_MASK) == AVR32_SEG_P1)
-		return (AVR32_P1_TO_PHYS(va));
-	else if ((va & AVR32_SEG_MASK) == AVR32_SEG_P2)
-		return (AVR32_P2_TO_PHYS(va));
-
 	ent = pmap_pte(pmap, va);
-	return pfn_get(*ent);
+	if (ent == NULL)
+		return (0);
+	return (pfn_get(*ent) | (va & PAGE_MASK));
 }
 
 vm_page_t



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903021823.n22INs3j024536>