From cc334002e97524dbc82eb5755b74fccfd73a4be9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 17 Jan 2012 18:06:53 +0000 Subject: [PATCH] [NTOSKRNL] - Only return the dirty bit if the PTE is actually valid - Avoid an unneeded TLB flush when setting the dirty bit svn path=/trunk/; revision=54993 --- reactos/ntoskrnl/mm/i386/page.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index 219b9aa9edf..9ebf1bd2b93 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -539,7 +539,7 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN FreePage, */ if (WasDirty != NULL) { - *WasDirty = Pte & PA_DIRTY ? TRUE : FALSE; + *WasDirty = ((Pte & PA_DIRTY) && (Pte & PA_PRESENT)) ? TRUE : FALSE; } if (Page != NULL) { @@ -687,12 +687,10 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address) { KeBugCheck(MEMORY_MANAGEMENT); } - else if (!(Pte & PA_DIRTY)) - { - MiFlushTlb(Pt, Address); - } else { + /* The processor will never clear this bit itself, therefore + * we do not need to flush the TLB here when setting it */ MmUnmapPageTable(Pt); } }