[NTOSKRNL:MM]
[reactos.git] / reactos / ntoskrnl / mm / ARM3 / expool.c
index 54b0f2c..032f4b7 100644 (file)
@@ -205,6 +205,9 @@ ExpCheckPoolHeader(IN PPOOL_HEADER Entry)
         if (PreviousEntry->BlockSize != Entry->PreviousSize)
         {
             /* Otherwise, someone corrupted one of the sizes */
+            DPRINT1("PreviousEntry BlockSize %lu, tag %.4s. Entry PreviousSize %lu, tag %.4s\n",
+                    PreviousEntry->BlockSize, (char *)&PreviousEntry->PoolTag,
+                    Entry->PreviousSize, (char *)&Entry->PoolTag);
             KeBugCheckEx(BAD_POOL_HEADER,
                          5,
                          (ULONG_PTR)PreviousEntry,
@@ -226,6 +229,18 @@ ExpCheckPoolHeader(IN PPOOL_HEADER Entry)
     if (!Entry->BlockSize)
     {
         /* Someone must've corrupted this field */
+        if (Entry->PreviousSize)
+        {
+            PreviousEntry = POOL_PREV_BLOCK(Entry);
+            DPRINT1("PreviousEntry tag %.4s. Entry tag %.4s\n",
+                    (char *)&PreviousEntry->PoolTag,
+                    (char *)&Entry->PoolTag);
+        }
+        else
+        {
+            DPRINT1("Entry tag %.4s\n",
+                    (char *)&Entry->PoolTag);
+        }
         KeBugCheckEx(BAD_POOL_HEADER,
                      8,
                      0,
@@ -254,6 +269,9 @@ ExpCheckPoolHeader(IN PPOOL_HEADER Entry)
         if (NextEntry->PreviousSize != Entry->BlockSize)
         {
             /* Otherwise, someone corrupted the field */
+            DPRINT1("Entry BlockSize %lu, tag %.4s. NextEntry PreviousSize %lu, tag %.4s\n",
+                    Entry->BlockSize, (char *)&Entry->PoolTag,
+                    NextEntry->PreviousSize, (char *)&NextEntry->PoolTag);
             KeBugCheckEx(BAD_POOL_HEADER,
                          5,
                          (ULONG_PTR)NextEntry,
@@ -1256,7 +1274,7 @@ ExpAddTagForBigPages(IN PVOID Va,
     // This means there's no free hash buckets whatsoever, so we would now have
     // to attempt expanding the table
     //
-    DPRINT1("Big pool expansion needed, not implemented!");
+    DPRINT1("Big pool expansion needed, not implemented!\n");
     KeReleaseSpinLock(&ExpLargePoolTableLock, OldIrql);
     return FALSE;
 }
@@ -2132,6 +2150,15 @@ ExFreePoolWithTag(IN PVOID P,
                          BlockSize * POOL_BLOCK_SIZE,
                          Entry->PoolType - 1);
 
+    //
+    // Check block tag
+    //
+    if (TagToFree && TagToFree != Tag)
+    {
+        DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Tag);
+        KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Tag, TagToFree);
+    }
+
     //
     // Is this allocation small enough to have come from a lookaside list?
     //
@@ -2182,15 +2209,6 @@ ExFreePoolWithTag(IN PVOID P,
     //
     OldIrql = ExLockPool(PoolDesc);
 
-    //
-    // Check block tag
-    //
-    if (TagToFree && TagToFree != Entry->PoolTag)
-    {
-        DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Entry->PoolTag);
-        KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Entry->PoolTag, TagToFree);
-    }
-
     //
     // Check if the next allocation is at the end of the page
     //