Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Dec 2011 07:18:54 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r228255 - stable/8/sys/amd64/amd64
Message-ID:  <201112040718.pB47Iss3075668@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun Dec  4 07:18:54 2011
New Revision: 228255
URL: http://svn.freebsd.org/changeset/base/228255

Log:
  MFC r213897
    Update pmap_extract() to handle 1GB page mappings.  Some device drivers
    use pmap_extract() rather than pmap_kextract() on direct map addresses.
    Thus, pmap_extract() needs to be able to deal with 1GB page mappings if
    we are to use 1GB page mappings for the direct map.  (See r197580.)

Modified:
  stable/8/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/8/sys/amd64/amd64/pmap.c	Sun Dec  4 06:55:27 2011	(r228254)
+++ stable/8/sys/amd64/amd64/pmap.c	Sun Dec  4 07:18:54 2011	(r228255)
@@ -1141,26 +1141,33 @@ pmap_is_current(pmap_t pmap)
 vm_paddr_t 
 pmap_extract(pmap_t pmap, vm_offset_t va)
 {
-	vm_paddr_t rtval;
+	pdp_entry_t *pdpe;
+	pd_entry_t *pde;
 	pt_entry_t *pte;
-	pd_entry_t pde, *pdep;
+	vm_paddr_t pa;
 
-	rtval = 0;
+	pa = 0;
 	PMAP_LOCK(pmap);
-	pdep = pmap_pde(pmap, va);
-	if (pdep != NULL) {
-		pde = *pdep;
-		if (pde) {
-			if ((pde & PG_PS) != 0)
-				rtval = (pde & PG_PS_FRAME) | (va & PDRMASK);
-			else {
-				pte = pmap_pde_to_pte(pdep, va);
-				rtval = (*pte & PG_FRAME) | (va & PAGE_MASK);
+	pdpe = pmap_pdpe(pmap, va);
+	if (pdpe != NULL && (*pdpe & PG_V) != 0) {
+		if ((*pdpe & PG_PS) != 0)
+			pa = (*pdpe & PG_PS_FRAME) | (va & PDPMASK);
+		else {
+			pde = pmap_pdpe_to_pde(pdpe, va);
+			if ((*pde & PG_V) != 0) {
+				if ((*pde & PG_PS) != 0) {
+					pa = (*pde & PG_PS_FRAME) |
+					    (va & PDRMASK);
+				} else {
+					pte = pmap_pde_to_pte(pde, va);
+					pa = (*pte & PG_FRAME) |
+					    (va & PAGE_MASK);
+				}
 			}
 		}
 	}
 	PMAP_UNLOCK(pmap);
-	return (rtval);
+	return (pa);
 }
 
 /*



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