diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index 39686a1dc24..cadfff53ed6 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -255,7 +255,6 @@ typedef struct _MADDRESS_SPACE PMEMORY_AREA MemoryAreaRoot; PVOID LowestAddress; PEPROCESS Process; - PUSHORT PageTableRefCountTable; PEX_PUSH_LOCK Lock; } MADDRESS_SPACE, *PMADDRESS_SPACE; diff --git a/reactos/ntoskrnl/mm/aspace.c b/reactos/ntoskrnl/mm/aspace.c index dd9cd5e8eaf..7ea175adccd 100644 --- a/reactos/ntoskrnl/mm/aspace.c +++ b/reactos/ntoskrnl/mm/aspace.c @@ -39,8 +39,6 @@ NTAPI MmInitializeAddressSpace(PEPROCESS Process, PMADDRESS_SPACE AddressSpace) { - ULONG Count; - AddressSpace->MemoryAreaRoot = NULL; if (Process != NULL) @@ -48,19 +46,12 @@ MmInitializeAddressSpace(PEPROCESS Process, AddressSpace->LowestAddress = MM_LOWEST_USER_ADDRESS; AddressSpace->Process = Process; AddressSpace->Lock = (PEX_PUSH_LOCK)&Process->AddressCreationLock; - ExInitializePushLock((PULONG_PTR)AddressSpace->Lock); - Count = MiGetUserPageDirectoryCount(); - AddressSpace->PageTableRefCountTable = ExAllocatePoolWithTag(NonPagedPool, - Count * sizeof(USHORT), - TAG_PTRC); - RtlZeroMemory(AddressSpace->PageTableRefCountTable, Count * sizeof(USHORT)); - + ExInitializePushLock((PULONG_PTR)AddressSpace->Lock); } else { AddressSpace->LowestAddress = MmSystemRangeStart; AddressSpace->Process = NULL; - AddressSpace->PageTableRefCountTable = NULL; AddressSpace->Lock = (PEX_PUSH_LOCK)&PsGetCurrentProcess()->AddressCreationLock; ExInitializePushLock((PULONG_PTR)AddressSpace->Lock); } @@ -72,11 +63,6 @@ NTSTATUS NTAPI MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace) { - if (AddressSpace->PageTableRefCountTable) - { - ExFreePool(AddressSpace->PageTableRefCountTable); - } - return STATUS_SUCCESS; } diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index 01f3ca2a26f..8c99a9aa2cc 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -145,9 +145,8 @@ Mmi386ReleaseMmInfo(PEPROCESS Process) { PUSHORT LdtDescriptor; ULONG LdtBase; - PULONG Pde; PULONG PageDir; - ULONG i, j; + ULONG i; DPRINT("Mmi386ReleaseMmInfo(Process %x)\n",Process); @@ -168,28 +167,7 @@ Mmi386ReleaseMmInfo(PEPROCESS Process) { if (PageDir[i] != 0) { - DPRINT1("Pde for %08x - %08x is not freed, RefCount %d\n", - i * 4 * 1024 * 1024, (i + 1) * 4 * 1024 * 1024 - 1, - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable[i]); - Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(PageDir[i])); - for (j = 0; j < 1024; j++) - { - if(Pde[j] != 0) - { - if (Pde[j] & PA_PRESENT) - { - DPRINT1("Page at %08x is not freed\n", - i * 4 * 1024 * 1024 + j * PAGE_SIZE); - } - else - { - DPRINT1("Swapentry %x at %x is not freed\n", - Pde[j], i * 4 * 1024 * 1024 + j * PAGE_SIZE); - - } - } - } - MmDeleteHyperspaceMapping(Pde); + MiZeroPage(PTE_TO_PFN(PageDir[i])); MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[i])); } } @@ -604,25 +582,6 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN FreePage, { *Page = Pfn; } - /* - * Decrement the reference count for this page table. - */ - if (Process != NULL && WasValid && - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable != NULL && - Address < MmSystemRangeStart) - { - PUSHORT Ptrc; - ULONG Idx; - - Ptrc = ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable; - Idx = ADDR_TO_PAGE_TABLE(Address); - - Ptrc[Idx]--; - if (Ptrc[Idx] == 0) - { - MmFreePageTable(Process, Address); - } - } } VOID @@ -651,25 +610,6 @@ MmDeletePageFileMapping(PEPROCESS Process, PVOID Address, MiFlushTlb(Pt, Address); - /* - * Decrement the reference count for this page table. - */ - if (Process != NULL && Pte && - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable != NULL && - Address < MmSystemRangeStart) - { - PUSHORT Ptrc; - - Ptrc = ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable; - - Ptrc[ADDR_TO_PAGE_TABLE(Address)]--; - if (Ptrc[ADDR_TO_PAGE_TABLE(Address)] == 0) - { - MmFreePageTable(Process, Address); - } - } - - /* * Return some information to the caller */ @@ -971,17 +911,6 @@ MmCreatePageFileMapping(PEPROCESS Process, MmUnmapPageTable(Pt); } - if (Process != NULL && - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable != NULL && - Address < MmSystemRangeStart) - { - PUSHORT Ptrc; - ULONG Idx; - - Ptrc = ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable; - Idx = ADDR_TO_PAGE_TABLE(Address); - Ptrc[Idx]++; - } return(STATUS_SUCCESS); } @@ -1092,16 +1021,6 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process, MmMarkPageUnmapped(PTE_TO_PFN((Pte))); } (void)InterlockedExchangeUL(Pt, PFN_TO_PTE(Pages[i]) | Attributes); - if (Address < MmSystemRangeStart && - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable != NULL && - Attributes & PA_PRESENT) - { - PUSHORT Ptrc; - - Ptrc = ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable; - - Ptrc[ADDR_TO_PAGE_TABLE(Addr)]++; - } if (Pte != 0) { if (Address > MmSystemRangeStart || @@ -1411,13 +1330,6 @@ MmInitGlobalKernelPageDirectory(VOID) } } -ULONG -NTAPI -MiGetUserPageDirectoryCount(VOID) -{ - return ADDR_TO_PDE_OFFSET(MmSystemRangeStart); -} - VOID INIT_FUNCTION NTAPI