diff --git a/ntoskrnl/mm/ARM3/arm/init.c b/ntoskrnl/mm/ARM3/arm/init.c index 2a2c48cb2ee..cdc1d398276 100644 --- a/ntoskrnl/mm/ARM3/arm/init.c +++ b/ntoskrnl/mm/ARM3/arm/init.c @@ -37,7 +37,7 @@ ULONG MmSessionPoolSize; ULONG MmSessionImageSize; PVOID MiSystemViewStart; ULONG MmSystemViewSize; -PFN_NUMBER MmSystemPageDirectory[PD_COUNT]; +PFN_NUMBER MmSystemPageDirectory[PPE_PER_PAGE]; PMMPDE MmSystemPagePtes; ULONG MmNumberOfSystemPtes; ULONG MxPfnAllocation; diff --git a/ntoskrnl/mm/ARM3/miarm.h b/ntoskrnl/mm/ARM3/miarm.h index b0fa87c4dea..15c17ab462a 100644 --- a/ntoskrnl/mm/ARM3/miarm.h +++ b/ntoskrnl/mm/ARM3/miarm.h @@ -19,21 +19,16 @@ #define _64K (64 * _1KB) /* Area mapped by a PDE */ -#define PDE_MAPPED_VA (PTE_COUNT * PAGE_SIZE) +#define PDE_MAPPED_VA (PTE_PER_PAGE * PAGE_SIZE) /* Size of a page table */ -#define PT_SIZE (PTE_COUNT * sizeof(MMPTE)) +#define PT_SIZE (PTE_PER_PAGE * sizeof(MMPTE)) /* Size of a page directory */ -#define PD_SIZE (PDE_COUNT * sizeof(MMPDE)) - -/* Stop using these! */ -#define PD_COUNT PPE_PER_PAGE -#define PDE_COUNT PDE_PER_PAGE -#define PTE_COUNT PTE_PER_PAGE +#define PD_SIZE (PDE_PER_PAGE * sizeof(MMPDE)) /* Size of all page directories for a process */ -#define SYSTEM_PD_SIZE (PD_COUNT * PD_SIZE) +#define SYSTEM_PD_SIZE (PPE_PER_PAGE * PD_SIZE) #ifdef _M_IX86 C_ASSERT(SYSTEM_PD_SIZE == PAGE_SIZE); #endif @@ -644,7 +639,7 @@ extern PVOID MiSessionImageStart; extern PVOID MiSessionImageEnd; extern PMMPTE MiHighestUserPte; extern PMMPDE MiHighestUserPde; -extern PFN_NUMBER MmSystemPageDirectory[PD_COUNT]; +extern PFN_NUMBER MmSystemPageDirectory[PPE_PER_PAGE]; extern PMMPTE MmSharedUserDataPte; extern LIST_ENTRY MmProcessList; extern BOOLEAN MmZeroingPageThreadActive; diff --git a/ntoskrnl/mm/ARM3/mminit.c b/ntoskrnl/mm/ARM3/mminit.c index fcd1c7dae2f..7cd7af10838 100644 --- a/ntoskrnl/mm/ARM3/mminit.c +++ b/ntoskrnl/mm/ARM3/mminit.c @@ -161,7 +161,7 @@ SIZE_T MmSystemViewSize; // map paged pool PDEs into external processes when they fault on a paged pool // address. // -PFN_NUMBER MmSystemPageDirectory[PD_COUNT]; +PFN_NUMBER MmSystemPageDirectory[PPE_PER_PAGE]; PMMPDE MmSystemPagePtes; #endif @@ -779,7 +779,7 @@ MiBuildPfnDatabaseFromPages(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Start with the first PDE and scan them all */ PointerPde = MiAddressToPde(NULL); - Count = PD_COUNT * PDE_COUNT; + Count = PPE_PER_PAGE * PDE_PER_PAGE; for (i = 0; i < Count; i++) { /* Check for valid PDE */ @@ -812,7 +812,7 @@ MiBuildPfnDatabaseFromPages(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Now get the PTE and scan the pages */ PointerPte = MiAddressToPte(BaseAddress); - for (j = 0; j < PTE_COUNT; j++) + for (j = 0; j < PTE_PER_PAGE; j++) { /* Check for a valid PTE */ if (PointerPte->u.Hard.Valid == 1) @@ -1439,7 +1439,7 @@ MiAddHalIoMappings(VOID) { /* Get the PTE for it and scan each page */ PointerPte = MiAddressToPte(BaseAddress); - for (j = 0 ; j < PTE_COUNT; j++) + for (j = 0; j < PTE_PER_PAGE; j++) { /* Does the HAL own this page? */ if (PointerPte->u.Hard.Valid == 1) @@ -1767,7 +1767,7 @@ MiBuildPagedPool(VOID) // Get the page frame number for the system page directory // PointerPte = MiAddressToPte(PDE_BASE); - ASSERT(PD_COUNT == 1); + ASSERT(PPE_PER_PAGE == 1); MmSystemPageDirectory[0] = PFN_FROM_PTE(PointerPte); // @@ -1785,7 +1785,7 @@ MiBuildPagedPool(VOID) // way). // TempPte = ValidKernelPte; - ASSERT(PD_COUNT == 1); + ASSERT(PPE_PER_PAGE == 1); TempPte.u.Hard.PageFrameNumber = MmSystemPageDirectory[0]; MI_WRITE_VALID_PTE(PointerPte, TempPte); #endif @@ -1894,12 +1894,12 @@ MiBuildPagedPool(VOID) PFN_FROM_PTE(MiAddressToPpe(MmPagedPoolStart))); #else /* Do it this way */ -// Bla = MmSystemPageDirectory[(PointerPde - (PMMPTE)PDE_BASE) / PDE_COUNT] +// Bla = MmSystemPageDirectory[(PointerPde - (PMMPTE)PDE_BASE) / PDE_PER_PAGE] /* Initialize the PFN entry for it */ MiInitializePfnForOtherProcess(PageFrameIndex, (PMMPTE)PointerPde, - MmSystemPageDirectory[(PointerPde - (PMMPDE)PDE_BASE) / PDE_COUNT]); + MmSystemPageDirectory[(PointerPde - (PMMPDE)PDE_BASE) / PDE_PER_PAGE]); #endif // diff --git a/ntoskrnl/mm/ARM3/pool.c b/ntoskrnl/mm/ARM3/pool.c index 5d6554bad75..347aa6ba967 100644 --- a/ntoskrnl/mm/ARM3/pool.c +++ b/ntoskrnl/mm/ARM3/pool.c @@ -480,7 +480,7 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType, // // Get the page bit count // - i = ((SizeInPages - 1) / PTE_COUNT) + 1; + i = ((SizeInPages - 1) / PTE_PER_PAGE) + 1; DPRINT("Paged pool expansion: %lu %x\n", i, SizeInPages); // @@ -566,7 +566,7 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType, /* Initialize the PFN */ MiInitializePfnForOtherProcess(PageFrameNumber, (PMMPTE)PointerPde, - MmSystemPageDirectory[(PointerPde - MiAddressToPde(NULL)) / PDE_COUNT]); + MmSystemPageDirectory[(PointerPde - MiAddressToPde(NULL)) / PDE_PER_PAGE]); #endif // @@ -586,11 +586,11 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType, // These pages are now available, clear their availablity bits // EndAllocation = (ULONG)(MmPagedPoolInfo.NextPdeForPagedPoolExpansion - - (PMMPDE)MiAddressToPte(MmPagedPoolInfo.FirstPteForPagedPool)) * - PTE_COUNT; + (PMMPDE)MiAddressToPte(MmPagedPoolInfo.FirstPteForPagedPool)) * + PTE_PER_PAGE; RtlClearBits(MmPagedPoolInfo.PagedPoolAllocationMap, EndAllocation, - PageTableCount * PTE_COUNT); + PageTableCount * PTE_PER_PAGE); // // Update the next expansion location diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c index 6bc1a6ef8db..abac73207cd 100644 --- a/ntoskrnl/mm/ARM3/section.c +++ b/ntoskrnl/mm/ARM3/section.c @@ -512,7 +512,7 @@ MiFillSystemPageDirectory(IN PVOID Base, TempPde.u.Hard.PageFrameNumber = PageFrameIndex; #if (_MI_PAGING_LEVELS == 2) - ParentPage = MmSystemPageDirectory[(PointerPde - MiAddressToPde(NULL)) / PDE_COUNT]; + ParentPage = MmSystemPageDirectory[(PointerPde - MiAddressToPde(NULL)) / PDE_PER_PAGE]; #else ParentPage = MiPdeToPpe(PointerPde)->u.Hard.PageFrameNumber; #endif diff --git a/ntoskrnl/mm/balance.c b/ntoskrnl/mm/balance.c index 324f3d84f7d..062432e3ecd 100644 --- a/ntoskrnl/mm/balance.c +++ b/ntoskrnl/mm/balance.c @@ -360,8 +360,8 @@ MiBalancerThread(PVOID Unused) KIRQL OldIrql = MiAcquirePfnLock(); PMMPDE pointerPde; for (Address = (ULONG_PTR)MI_LOWEST_VAD_ADDRESS; - Address < (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS; - Address += (PAGE_SIZE * PTE_COUNT)) + Address < (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS; + Address += PTE_PER_PAGE * PAGE_SIZE) { if (MiQueryPageTableReferences((PVOID)Address) == 0) { diff --git a/ntoskrnl/mm/i386/page.c b/ntoskrnl/mm/i386/page.c index e09f1212780..78e17b45659 100644 --- a/ntoskrnl/mm/i386/page.c +++ b/ntoskrnl/mm/i386/page.c @@ -12,6 +12,7 @@ #include #define NDEBUG #include + #include #if defined (ALLOC_PRAGMA) @@ -389,7 +390,7 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, { /* Remove PDE reference */ Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]--; - ASSERT(Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] < PTE_COUNT); + ASSERT(Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] < PTE_PER_PAGE); } Pfn = PTE_TO_PFN(Pte); @@ -453,7 +454,7 @@ MmDeletePageFileMapping(PEPROCESS Process, PVOID Address, { /* Remove PDE reference */ Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]--; - ASSERT(Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] < PTE_COUNT); + ASSERT(Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] < PTE_PER_PAGE); } /* We don't need to flush here because page file entries @@ -638,7 +639,7 @@ MmCreatePageFileMapping(PEPROCESS Process, { /* Add PDE reference */ Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++; - ASSERT(Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT); + ASSERT(Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_PER_PAGE); } /* We don't need to flush the TLB here because it @@ -755,7 +756,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process, { /* Add PDE reference */ Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Addr)]++; - ASSERT(Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Addr)] <= PTE_COUNT); + ASSERT(Process->Vm.VmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Addr)] <= PTE_PER_PAGE); } } diff --git a/ntoskrnl/mm/marea.c b/ntoskrnl/mm/marea.c index 537c17b0dda..37584477090 100644 --- a/ntoskrnl/mm/marea.c +++ b/ntoskrnl/mm/marea.c @@ -599,8 +599,8 @@ MmDeleteProcessAddressSpace(PEPROCESS Process) OldIrql = MiAcquirePfnLock(); for (Address = MI_LOWEST_VAD_ADDRESS; - Address < MM_HIGHEST_VAD_ADDRESS; - Address =(PVOID)((ULONG_PTR)Address + (PAGE_SIZE * PTE_COUNT))) + Address < MM_HIGHEST_VAD_ADDRESS; + Address = (PVOID)((ULONG_PTR)Address + (PTE_PER_PAGE * PAGE_SIZE))) { /* At this point all references should be dead */ if (MiQueryPageTableReferences(Address) != 0)