Date: Tue, 27 Sep 2016 10:26:39 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306365 - in stable/11/sys/amd64: amd64 include Message-ID: <201609271026.u8RAQd55049701@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Sep 27 10:26:39 2016 New Revision: 306365 URL: https://svnweb.freebsd.org/changeset/base/306365 Log: MFC r306020: Move pmap_p*e_index() inline functions from pmap.c to pmap.h. Modified: stable/11/sys/amd64/amd64/minidump_machdep.c stable/11/sys/amd64/amd64/pmap.c stable/11/sys/amd64/include/pmap.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/minidump_machdep.c Tue Sep 27 09:44:30 2016 (r306364) +++ stable/11/sys/amd64/amd64/minidump_machdep.c Tue Sep 27 10:26:39 2016 (r306365) @@ -239,10 +239,10 @@ minidumpsys(struct dumperinfo *di) * page written corresponds to 1GB of space */ pmapsize += PAGE_SIZE; - ii = (va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1); + ii = pmap_pml4e_index(va); pml4 = (uint64_t *)PHYS_TO_DMAP(KPML4phys) + ii; pdp = (uint64_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME); - i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1); + i = pmap_pdpe_index(va); if ((pdp[i] & PG_V) == 0) { va += NBPDP; continue; @@ -264,7 +264,7 @@ minidumpsys(struct dumperinfo *di) pd = (uint64_t *)PHYS_TO_DMAP(pdp[i] & PG_FRAME); for (n = 0; n < NPDEPG; n++, va += NBPDR) { - j = (va >> PDRSHIFT) & ((1ul << NPDEPGSHIFT) - 1); + j = pmap_pde_index(va); if ((pd[j] & PG_V) == 0) continue; @@ -368,10 +368,10 @@ minidumpsys(struct dumperinfo *di) bzero(fakepd, sizeof(fakepd)); for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR, kernel_vm_end); va += NBPDP) { - ii = (va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1); + ii = pmap_pml4e_index(va); pml4 = (uint64_t *)PHYS_TO_DMAP(KPML4phys) + ii; pdp = (uint64_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME); - i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1); + i = pmap_pdpe_index(va); /* We always write a page, even if it is zero */ if ((pdp[i] & PG_V) == 0) { Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Tue Sep 27 09:44:30 2016 (r306364) +++ stable/11/sys/amd64/amd64/pmap.c Tue Sep 27 10:26:39 2016 (r306365) @@ -673,35 +673,6 @@ pmap_pde_pindex(vm_offset_t va) } -/* Return various clipped indexes for a given VA */ -static __inline vm_pindex_t -pmap_pte_index(vm_offset_t va) -{ - - return ((va >> PAGE_SHIFT) & ((1ul << NPTEPGSHIFT) - 1)); -} - -static __inline vm_pindex_t -pmap_pde_index(vm_offset_t va) -{ - - return ((va >> PDRSHIFT) & ((1ul << NPDEPGSHIFT) - 1)); -} - -static __inline vm_pindex_t -pmap_pdpe_index(vm_offset_t va) -{ - - return ((va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1)); -} - -static __inline vm_pindex_t -pmap_pml4e_index(vm_offset_t va) -{ - - return ((va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1)); -} - /* Return a pointer to the PML4 slot that corresponds to a VA */ static __inline pml4_entry_t * pmap_pml4e(pmap_t pmap, vm_offset_t va) Modified: stable/11/sys/amd64/include/pmap.h ============================================================================== --- stable/11/sys/amd64/include/pmap.h Tue Sep 27 09:44:30 2016 (r306364) +++ stable/11/sys/amd64/include/pmap.h Tue Sep 27 10:26:39 2016 (r306365) @@ -416,6 +416,35 @@ boolean_t pmap_map_io_transient(vm_page_ void pmap_unmap_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t); #endif /* _KERNEL */ +/* Return various clipped indexes for a given VA */ +static __inline vm_pindex_t +pmap_pte_index(vm_offset_t va) +{ + + return ((va >> PAGE_SHIFT) & ((1ul << NPTEPGSHIFT) - 1)); +} + +static __inline vm_pindex_t +pmap_pde_index(vm_offset_t va) +{ + + return ((va >> PDRSHIFT) & ((1ul << NPDEPGSHIFT) - 1)); +} + +static __inline vm_pindex_t +pmap_pdpe_index(vm_offset_t va) +{ + + return ((va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1)); +} + +static __inline vm_pindex_t +pmap_pml4e_index(vm_offset_t va) +{ + + return ((va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1)); +} + #endif /* !LOCORE */ #endif /* !_MACHINE_PMAP_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609271026.u8RAQd55049701>