Author: cgutman Date: Tue Jan 17 18:06:53 2012 New Revision: 54993
URL: http://svn.reactos.org/svn/reactos?rev=54993&view=rev Log: [NTOSKRNL] - Only return the dirty bit if the PTE is actually valid - Avoid an unneeded TLB flush when setting the dirty bit
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Tue Jan 17 18:06:53 2012 @@ -539,7 +539,7 @@ */ 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 @@ { KeBugCheck(MEMORY_MANAGEMENT); } - else if (!(Pte & PA_DIRTY)) - { - MiFlushTlb(Pt, Address); - } - else - { + else + { + /* The processor will never clear this bit itself, therefore + * we do not need to flush the TLB here when setting it */ MmUnmapPageTable(Pt); } }