https://git.reactos.org/?p=reactos.git;a=commitdiff;h=146337cc50e29e3f11e55e...
commit 146337cc50e29e3f11e55ede4885f5967e86d3f3 Author: Jérôme Gardou jerome.gardou@reactos.org AuthorDate: Thu Jun 24 16:35:00 2021 +0200 Commit: Jérôme Gardou zefklop@users.noreply.github.com CommitDate: Thu Jun 24 18:48:31 2021 +0200
[NTOS:MM] Save caller address when tracing PFNs --- ntoskrnl/include/internal/mm.h | 3 ++- ntoskrnl/mm/ARM3/pfnlist.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h index 81c3954d8ae..0b75e613687 100644 --- a/ntoskrnl/include/internal/mm.h +++ b/ntoskrnl/include/internal/mm.h @@ -275,7 +275,7 @@ void MI_SET_PROCESS_USTR(PUNICODE_STRING ustr) { PWSTR pos, strEnd; - int i; + ULONG i;
if (!ustr->Buffer || ustr->Length == 0) { @@ -407,6 +407,7 @@ typedef struct _MMPFN MI_PFN_USAGES PfnUsage; CHAR ProcessName[16]; #define MI_SET_PFN_PROCESS_NAME(pfn, x) memcpy(pfn->ProcessName, x, min(sizeof(x), sizeof(pfn->ProcessName))) + PVOID CallSite; #endif
// HACK until WS lists are supported diff --git a/ntoskrnl/mm/ARM3/pfnlist.c b/ntoskrnl/mm/ARM3/pfnlist.c index 726143870f4..bbf4275a9df 100644 --- a/ntoskrnl/mm/ARM3/pfnlist.c +++ b/ntoskrnl/mm/ARM3/pfnlist.c @@ -254,6 +254,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry) ASSERT(MI_PFN_CURRENT_USAGE != MI_USAGE_NOT_SET); Entry->PfnUsage = MI_PFN_CURRENT_USAGE; memcpy(Entry->ProcessName, MI_PFN_CURRENT_PROCESS_NAME, 16); + Entry->CallSite = _ReturnAddress(); MI_PFN_CURRENT_USAGE = MI_USAGE_NOT_SET; MI_SET_PROCESS2("Not Set"); #endif @@ -462,6 +463,7 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex, ASSERT(MI_PFN_CURRENT_USAGE != MI_USAGE_NOT_SET); Pfn1->PfnUsage = MI_PFN_CURRENT_USAGE; memcpy(Pfn1->ProcessName, MI_PFN_CURRENT_PROCESS_NAME, 16); + Pfn1->CallSite = _ReturnAddress(); MI_PFN_CURRENT_USAGE = MI_USAGE_NOT_SET; MI_SET_PROCESS2("Not Set"); #endif @@ -710,6 +712,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) #if MI_TRACE_PFNS Pfn1->PfnUsage = MI_USAGE_FREE_PAGE; RtlZeroMemory(Pfn1->ProcessName, 16); + Pfn1->CallSite = NULL; #endif }
@@ -940,6 +943,7 @@ MiInsertPageInList(IN PMMPFNLIST ListHead, ASSERT(MI_PFN_CURRENT_USAGE == MI_USAGE_NOT_SET); Pfn1->PfnUsage = MI_USAGE_FREE_PAGE; RtlZeroMemory(Pfn1->ProcessName, 16); + Pfn1->CallSite = NULL; #endif } else if (ListName == ModifiedPageList)