[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
This commit is contained in:
Cameron Gutman 2012-01-17 18:06:53 +00:00
parent 292cd6d2b7
commit cc334002e9

View file

@ -539,7 +539,7 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN FreePage,
*/ */
if (WasDirty != NULL) if (WasDirty != NULL)
{ {
*WasDirty = Pte & PA_DIRTY ? TRUE : FALSE; *WasDirty = ((Pte & PA_DIRTY) && (Pte & PA_PRESENT)) ? TRUE : FALSE;
} }
if (Page != NULL) if (Page != NULL)
{ {
@ -687,12 +687,10 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address)
{ {
KeBugCheck(MEMORY_MANAGEMENT); 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); MmUnmapPageTable(Pt);
} }
} }