https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1c5ce8d11cbcce37a5ade…
commit 1c5ce8d11cbcce37a5ade6e3b4ab836546d52c2e
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Thu Jun 24 17:01:38 2021 +0200
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Thu Jun 24 18:48:31 2021 +0200
[NTOS:MM] Fix-up call site of traced PFNs when serving a page fault
---
ntoskrnl/mm/ARM3/pagfault.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/ntoskrnl/mm/ARM3/pagfault.c b/ntoskrnl/mm/ARM3/pagfault.c
index 4656828a3b0..8d1ce33c399 100644
--- a/ntoskrnl/mm/ARM3/pagfault.c
+++ b/ntoskrnl/mm/ARM3/pagfault.c
@@ -1286,6 +1286,14 @@ MiResolveProtoPteFault(IN BOOLEAN StoreInstruction,
(ULONG)TempPte.u.Soft.Protection,
Process,
OldIrql);
+#if MI_TRACE_PFNS
+ /* Update debug info */
+ if (TrapInformation)
+ MiGetPfnEntry(PointerProtoPte->u.Hard.PageFrameNumber)->CallSite =
(PVOID)((PKTRAP_FRAME)TrapInformation)->Eip;
+ else
+ MiGetPfnEntry(PointerProtoPte->u.Hard.PageFrameNumber)->CallSite =
_ReturnAddress();
+#endif
+
ASSERT(NT_SUCCESS(Status));
}
@@ -1637,6 +1645,14 @@ MiDispatchFault(IN ULONG FaultCode,
ASSERT(KeAreAllApcsDisabled() == TRUE);
if (NT_SUCCESS(Status))
{
+#if MI_TRACE_PFNS
+ /* Update debug info */
+ if (TrapInformation)
+ MiGetPfnEntry(PointerPte->u.Hard.PageFrameNumber)->CallSite =
(PVOID)((PKTRAP_FRAME)TrapInformation)->Eip;
+ else
+ MiGetPfnEntry(PointerPte->u.Hard.PageFrameNumber)->CallSite =
_ReturnAddress();
+#endif
+
//
// Make sure we're returning in a sane state and pass the status down
//
@@ -2191,6 +2207,11 @@ UserFault:
#if MI_TRACE_PFNS
UserPdeFault = FALSE;
+ /* Update debug info */
+ if (TrapInformation)
+ MiGetPfnEntry(PointerPde->u.Hard.PageFrameNumber)->CallSite =
(PVOID)((PKTRAP_FRAME)TrapInformation)->Eip;
+ else
+ MiGetPfnEntry(PointerPde->u.Hard.PageFrameNumber)->CallSite =
_ReturnAddress();
#endif
/* We should come back with APCs enabled, and with a valid PDE */
ASSERT(KeAreAllApcsDisabled() == TRUE);
@@ -2286,6 +2307,14 @@ UserFault:
CurrentProcess,
MM_NOIRQL);
+#if MI_TRACE_PFNS
+ /* Update debug info */
+ if (TrapInformation)
+ MiGetPfnEntry(PointerPte->u.Hard.PageFrameNumber)->CallSite =
(PVOID)((PKTRAP_FRAME)TrapInformation)->Eip;
+ else
+ MiGetPfnEntry(PointerPte->u.Hard.PageFrameNumber)->CallSite =
_ReturnAddress();
+#endif
+
/* Return the status */
MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread);
return STATUS_PAGE_FAULT_DEMAND_ZERO;