[NTOS:MM] Pass FaultCode to MiDispatchFault

This commit is contained in:
Timo Kreuzer 2018-01-01 22:40:43 +01:00
parent 3f426aabde
commit 1014d50a4b
2 changed files with 11 additions and 10 deletions

View file

@ -1274,7 +1274,7 @@ MiResolveProtoPteFault(IN BOOLEAN StoreInstruction,
NTSTATUS
NTAPI
MiDispatchFault(IN BOOLEAN StoreInstruction,
MiDispatchFault(IN ULONG FaultCode,
IN PVOID Address,
IN PMMPTE PointerPte,
IN PMMPTE PointerProtoPte,
@ -1333,7 +1333,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
}
/* Resolve the fault -- this will release the PFN lock */
Status = MiResolveProtoPteFault(StoreInstruction,
Status = MiResolveProtoPteFault(!MI_IS_NOT_PRESENT_FAULT(FaultCode),
Address,
PointerPte,
PointerProtoPte,
@ -1450,7 +1450,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
if (++ProcessedPtes == PteCount)
{
/* Complete the fault */
MiCompleteProtoPteFault(StoreInstruction,
MiCompleteProtoPteFault(!MI_IS_NOT_PRESENT_FAULT(FaultCode),
Address,
PointerPte,
PointerProtoPte,
@ -1489,7 +1489,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
ASSERT(PointerPte->u.Hard.Valid == 0);
/* Resolve the fault -- this will release the PFN lock */
Status = MiResolveProtoPteFault(StoreInstruction,
Status = MiResolveProtoPteFault(!MI_IS_NOT_PRESENT_FAULT(FaultCode),
Address,
PointerPte,
PointerProtoPte,
@ -1537,7 +1537,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
LockIrql = MiAcquirePfnLock();
/* Resolve */
Status = MiResolveTransitionFault(StoreInstruction, Address, PointerPte, Process, LockIrql, &InPageBlock);
Status = MiResolveTransitionFault(!MI_IS_NOT_PRESENT_FAULT(FaultCode), Address, PointerPte, Process, LockIrql, &InPageBlock);
ASSERT(NT_SUCCESS(Status));
@ -1576,7 +1576,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
LockIrql = MiAcquirePfnLock();
/* Resolve */
Status = MiResolvePageFileFault(StoreInstruction, Address, PointerPte, Process, &LockIrql);
Status = MiResolvePageFileFault(!MI_IS_NOT_PRESENT_FAULT(FaultCode), Address, PointerPte, Process, &LockIrql);
/* And now release the lock and leave*/
MiReleasePfnLock(LockIrql);
@ -2028,7 +2028,7 @@ _WARN("Session space stuff is not implemented yet!")
}
/* Now do the real fault handling */
Status = MiDispatchFault(!MI_IS_NOT_PRESENT_FAULT(FaultCode),
Status = MiDispatchFault(FaultCode,
Address,
PointerPte,
ProtoPte,
@ -2480,7 +2480,7 @@ UserFault:
}
/* Dispatch the fault */
Status = MiDispatchFault(!MI_IS_NOT_PRESENT_FAULT(FaultCode),
Status = MiDispatchFault(FaultCode,
Address,
PointerPte,
ProtoPte,

View file

@ -191,7 +191,7 @@ ProtectToPTE(ULONG flProtect)
NTSTATUS
NTAPI
MiDispatchFault(IN BOOLEAN StoreInstruction,
MiDispatchFault(IN ULONG FaultCode,
IN PVOID Address,
IN PMMPTE PointerPte,
IN PMMPTE PointerProtoPte,
@ -262,7 +262,8 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
ASSERT(PointerPde->u.Long == 0);
MI_WRITE_INVALID_PTE(PointerPde, DemandZeroPde);
Status = MiDispatchFault(TRUE,
// Tiny HACK: Parameter 1 is the architecture specific FaultCode for an access violation (i.e. page is present)
Status = MiDispatchFault(0x1,
Pt,
PointerPde,
NULL,