diff --git a/reactos/ntoskrnl/cache/section/data.c b/reactos/ntoskrnl/cache/section/data.c index 699ba61fae4..68218453d80 100644 --- a/reactos/ntoskrnl/cache/section/data.c +++ b/reactos/ntoskrnl/cache/section/data.c @@ -49,6 +49,7 @@ #include "../newcc.h" #define NDEBUG #include +#include "../mm/ARM3/miarm.h" #define DPRINTC DPRINT @@ -56,6 +57,7 @@ LIST_ENTRY MiSegmentList; extern KEVENT MpwThreadEvent; extern KSPIN_LOCK MiSectionPageTableLock; +extern PMMWSL MmWorkingSetList; /* GLOBALS *******************************************************************/ @@ -137,9 +139,18 @@ MiZeroFillSection { MmSetPageEntrySectionSegment(Segment, &FileOffset, MAKE_PFN_SSE(Page)); Address = ((PCHAR)MemoryArea->StartingAddress) + FileOffset.QuadPart - FirstMapped.QuadPart; + MmReferencePage(Page); MmCreateVirtualMapping(NULL, Address, PAGE_READWRITE, &Page, 1); MmInsertRmap(Page, NULL, Address); +#if (_MI_PAGING_LEVELS == 2) + /* Reference Page Directory Entry */ + if(Address < MmSystemRangeStart) + { + MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++; + ASSERT(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT); + } +#endif } else MmReleasePageMemoryConsumer(MC_CACHE, Page); diff --git a/reactos/ntoskrnl/cache/section/fault.c b/reactos/ntoskrnl/cache/section/fault.c index e6050bd5fb6..f0a1a7f629e 100644 --- a/reactos/ntoskrnl/cache/section/fault.c +++ b/reactos/ntoskrnl/cache/section/fault.c @@ -49,10 +49,12 @@ #include "newmm.h" #define NDEBUG #include +#include "../mm/ARM3/miarm.h" #define DPRINTC DPRINT extern KEVENT MmWaitPageEvent; +extern PMMWSL MmWorkingSetList; NTSTATUS NTAPI @@ -140,6 +142,14 @@ MmNotPresentFaultCachePage { DPRINT("Set %x in address space @ %x\n", Required->Page[0], Address); Status = MmCreateVirtualMapping(Process, Address, Attributes, Required->Page, 1); +#if (_MI_PAGING_LEVELS == 2) + /* Reference Page Directory Entry */ + if(Address < MmSystemRangeStart) + { + MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++; + ASSERT(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT); + } +#endif if (NT_SUCCESS(Status)) { MmInsertRmap(Required->Page[0], Process, Address); @@ -164,6 +174,14 @@ MmNotPresentFaultCachePage MmReferencePage(Page); Status = MmCreateVirtualMapping(Process, Address, Attributes, &Page, 1); +#if (_MI_PAGING_LEVELS == 2) + /* Reference Page Directory Entry */ + if(Address < MmSystemRangeStart) + { + MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++; + ASSERT(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT); + } +#endif if (NT_SUCCESS(Status)) { MmInsertRmap(Page, Process, Address);