[NTOS]: Fix multiple math/logic bugs in the PrototypePTE paths. Caught while trying to switch the Win32k GDI Handle Table to ARM3 sections.

svn path=/trunk/; revision=49209
This commit is contained in:
Sir Richard 2010-10-19 18:57:30 +00:00
parent ef6bc56d6f
commit 6f48b81057
2 changed files with 20 additions and 20 deletions

View file

@ -241,7 +241,7 @@ extern const ULONG MmProtectToValue[32];
//
#define MiProtoPteToPte(x) \
(PMMPTE)((ULONG_PTR)MmPagedPoolStart + \
((x)->u.Proto.ProtoAddressHigh | (x)->u.Proto.ProtoAddressLow))
(((x)->u.Proto.ProtoAddressHigh << 7) | (x)->u.Proto.ProtoAddressLow))
#endif
//
@ -627,7 +627,8 @@ MI_MAKE_PROTOTYPE_PTE(IN PMMPTE NewPte,
/* 7 bits go in the "low", and the other 21 bits go in the "high" */
NewPte->u.Proto.ProtoAddressLow = Offset & 0x7F;
NewPte->u.Proto.ProtoAddressHigh = Offset & 0xFFFFF80;
NewPte->u.Proto.ProtoAddressHigh = (Offset & 0xFFFFFF80) >> 7;
ASSERT(MiProtoPteToPte(NewPte) == PointerPte);
}
#endif

View file

@ -805,7 +805,8 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
/* Get the prototype PTE! */
ProtoPte = MiProtoPteToPte(&TempPte);
}
else
{
//
// We don't implement transition PTEs
//
@ -821,6 +822,7 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
(ULONG_PTR)TrapInformation,
1);
}
}
/* Check for demand page */
if ((StoreInstruction) && !(ProtoPte) && !(TempPte.u.Hard.Valid))
@ -874,8 +876,6 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
#endif
/* First things first, is the PDE valid? */
// DPRINT1("The PDE we faulted on: %lx %lx\n", PointerPde, MiAddressToPde(PTE_BASE));
//ASSERT(PointerPde != MiAddressToPde(PTE_BASE));
ASSERT(PointerPde->u.Hard.LargePage == 0);
if (PointerPde->u.Hard.Valid == 0)
{
@ -918,7 +918,6 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
if (TempPte.u.Long == (MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS))
{
/* Resolve the fault */
//DPRINT1("VAD demand-zero fault: %p\n", Address);
MiResolveDemandZeroFault(Address,
PointerPte,
CurrentProcess,