[NTOS:MM]
authorThomas Faber <thomas.faber@reactos.org>
Mon, 22 May 2017 13:30:44 +0000 (13:30 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 22 May 2017 13:30:44 +0000 (13:30 +0000)
- Make PFN tracing work... somewhat

svn path=/trunk/; revision=74626

reactos/ntoskrnl/cc/view.c
reactos/ntoskrnl/mm/ARM3/pagfault.c
reactos/ntoskrnl/mm/ARM3/section.c
reactos/ntoskrnl/mm/ARM3/session.c
reactos/ntoskrnl/mm/ARM3/special.c
reactos/ntoskrnl/mm/ARM3/sysldr.c

index b117027..f38a028 100644 (file)
@@ -607,6 +607,7 @@ CcRosMapVacb(
     {
         PFN_NUMBER PageFrameNumber;
 
+        MI_SET_USAGE(MI_USAGE_CACHE);
         Status = MmRequestPageMemoryConsumer(MC_CACHE, TRUE, &PageFrameNumber);
         if (PageFrameNumber == 0)
         {
@@ -741,8 +742,15 @@ CcRosCreateVacb (
         PWCHAR pos = NULL;
         ULONG len = 0;
         pos = wcsrchr(SharedCacheMap->FileObject->FileName.Buffer, '\\');
-        len = wcslen(pos) * sizeof(WCHAR);
-        if (pos) snprintf(MI_PFN_CURRENT_PROCESS_NAME, min(16, len), "%S", pos);
+        if (pos)
+        {
+            len = wcslen(pos) * sizeof(WCHAR);
+            snprintf(MI_PFN_CURRENT_PROCESS_NAME, min(16, len), "%S", pos);
+        }
+        else
+        {
+            snprintf(MI_PFN_CURRENT_PROCESS_NAME, min(16, len), "%wZ", &SharedCacheMap->FileObject->FileName);
+        }
     }
 #endif
 
index 1a3772a..0ded2d6 100644 (file)
@@ -653,8 +653,9 @@ MiResolveDemandZeroFault(IN PVOID Address,
     if (UserPdeFault) MI_SET_USAGE(MI_USAGE_PAGE_TABLE);
     if (!UserPdeFault) MI_SET_USAGE(MI_USAGE_DEMAND_ZERO);
 #endif
-    if (Process) MI_SET_PROCESS2(Process->ImageFileName);
-    if (!Process) MI_SET_PROCESS2("Kernel Demand 0");
+    if (Process == HYDRA_PROCESS) MI_SET_PROCESS2("Hydra");
+    else if (Process) MI_SET_PROCESS2(Process->ImageFileName);
+    else MI_SET_PROCESS2("Kernel Demand 0");
 
     /* Do we need a zero page? */
     if (Color != 0xFFFFFFFF)
index a71dcd7..ab45672 100644 (file)
@@ -994,6 +994,8 @@ _WARN("MiSessionCommitPageTables halfplemented for amd64")
 
             /* Acquire the PFN lock and grab a zero page */
             OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+            MI_SET_USAGE(MI_USAGE_PAGE_TABLE);
+            MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
             Color = (++MmSessionSpace->Color) & MmSecondaryColorMask;
             PageFrameNumber = MiRemoveZeroPage(Color);
             TempPde.u.Hard.PageFrameNumber = PageFrameNumber;
index 117c40b..2404a88 100644 (file)
@@ -511,6 +511,7 @@ MiSessionInitializeWorkingSetList(VOID)
     if (AllocatedPageTable != FALSE)
     {
         /* Get a zeroed colored zero page */
+        MI_SET_USAGE(MI_USAGE_INIT_MEMORY);
         Color = MI_GET_NEXT_COLOR();
         PageFrameIndex = MiRemoveZeroPageSafe(Color);
         if (!PageFrameIndex)
@@ -542,6 +543,7 @@ MiSessionInitializeWorkingSetList(VOID)
     }
 
     /* Get a zeroed colored zero page */
+    MI_SET_USAGE(MI_USAGE_INIT_MEMORY);
     Color = MI_GET_NEXT_COLOR();
     PageFrameIndex = MiRemoveZeroPageSafe(Color);
     if (!PageFrameIndex)
@@ -679,6 +681,7 @@ MiSessionCreateInternal(OUT PULONG SessionId)
     for (i = 0; i < MiSessionDataPages; i++)
     {
         /* Get a zeroed colored zero page */
+        MI_SET_USAGE(MI_USAGE_INIT_MEMORY);
         Color = MI_GET_NEXT_COLOR();
         DataPage[i] = MiRemoveZeroPageSafe(Color);
         if (!DataPage[i])
@@ -701,6 +704,7 @@ MiSessionCreateInternal(OUT PULONG SessionId)
     SessionGlobal = MiPteToAddress(SessionPte);
 
     /* Get a zeroed colored zero page */
+    MI_SET_USAGE(MI_USAGE_INIT_MEMORY);
     Color = MI_GET_NEXT_COLOR();
     SessionPageDirIndex = MiRemoveZeroPageSafe(Color);
     if (!SessionPageDirIndex)
@@ -742,6 +746,7 @@ MiSessionCreateInternal(OUT PULONG SessionId)
     for (i = 0; i < MiSessionTagPages; i++)
     {
         /* Grab a zeroed colored page */
+        MI_SET_USAGE(MI_USAGE_INIT_MEMORY);
         Color = MI_GET_NEXT_COLOR();
         TagPage[i] = MiRemoveZeroPageSafe(Color);
         if (!TagPage[i])
index dfc8d57..bb0a5f8 100644 (file)
@@ -328,6 +328,15 @@ MmAllocateSpecialPool(SIZE_T NumberOfBytes, ULONG Tag, POOL_TYPE PoolType, ULONG
     MiSpecialPoolFirstPte = MmSystemPteBase + PointerPte->u.List.NextEntry;
 
     /* Allocate a physical page */
+    if (PoolType == PagedPool)
+    {
+        MI_SET_USAGE(MI_USAGE_PAGED_POOL);
+    }
+    else
+    {
+        MI_SET_USAGE(MI_USAGE_NONPAGED_POOL);
+    }
+    MI_SET_PROCESS2("Kernel-Special");
     PageFrameNumber = MiRemoveAnyPage(MI_GET_NEXT_COLOR());
 
     /* Initialize PFN and make it valid */
index a21e552..0b929f7 100644 (file)
@@ -178,19 +178,6 @@ MiLoadImageSection(IN OUT PVOID *SectionPtr,
     /* Lock the PFN database */
     OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
 
-    /* Some debug stuff */
-    MI_SET_USAGE(MI_USAGE_DRIVER_PAGE);
-#if MI_TRACE_PFNS
-    if (FileName->Buffer)
-    {
-        PWCHAR pos = NULL;
-        ULONG len = 0;
-        pos = wcsrchr(FileName->Buffer, '\\');
-        len = wcslen(pos) * sizeof(WCHAR);
-        if (pos) snprintf(MI_PFN_CURRENT_PROCESS_NAME, min(16, len), "%S", pos);
-    }
-#endif
-
     /* Loop the new driver PTEs */
     TempPte = ValidKernelPte;
     while (PointerPte < LastPte)
@@ -198,6 +185,19 @@ MiLoadImageSection(IN OUT PVOID *SectionPtr,
         /* Make sure the PTE is not valid for whatever reason */
         ASSERT(PointerPte->u.Hard.Valid == 0);
 
+        /* Some debug stuff */
+        MI_SET_USAGE(MI_USAGE_DRIVER_PAGE);
+#if MI_TRACE_PFNS
+        if (FileName->Buffer)
+        {
+            PWCHAR pos = NULL;
+            ULONG len = 0;
+            pos = wcsrchr(FileName->Buffer, '\\');
+            len = wcslen(pos) * sizeof(WCHAR);
+            if (pos) snprintf(MI_PFN_CURRENT_PROCESS_NAME, min(16, len), "%S", pos);
+        }
+#endif
+
         /* Grab a page */
         PageFrameIndex = MiRemoveAnyPage(MI_GET_NEXT_COLOR());