Date: Fri, 15 Oct 2010 15:23:34 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r213897 - head/sys/amd64/amd64 Message-ID: <201010151523.o9FFNYsU065620@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Fri Oct 15 15:23:34 2010 New Revision: 213897 URL: http://svn.freebsd.org/changeset/base/213897 Log: 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: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Oct 15 15:16:36 2010 (r213896) +++ head/sys/amd64/amd64/pmap.c Fri Oct 15 15:23:34 2010 (r213897) @@ -1163,26 +1163,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?201010151523.o9FFNYsU065620>