Author: fireball
Date: Wed Apr 29 13:48:31 2009
New Revision: 40727
URL:
http://svn.reactos.org/svn/reactos?rev=40727&view=rev
Log:
- Debug pool allocator: Add support for paged pool debugging.
Modified:
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/dbgpool.c
trunk/reactos/ntoskrnl/mm/pool.c
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Wed Apr 29 13:48:31 2009
@@ -574,7 +574,7 @@
VOID
NTAPI
-ExpFreeDebugPool(PVOID Block);
+ExpFreeDebugPool(PVOID Block, BOOLEAN PagedPool);
VOID
NTAPI
Modified: trunk/reactos/ntoskrnl/mm/dbgpool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/dbgpool.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/dbgpool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/dbgpool.c [iso-8859-1] Wed Apr 29 13:48:31 2009
@@ -91,7 +91,7 @@
VOID
NTAPI
-ExpFreeDebugPool(PVOID Block)
+ExpFreeDebugPool(PVOID Block, BOOLEAN PagedPool)
{
PEI_WHOLE_PAGE_HEADER Header;
PVOID ProtectedPage;
@@ -111,7 +111,10 @@
MmSetPageProtect(NULL, ProtectedPage, PAGE_READWRITE);
/* Free storage */
- ExFreeNonPagedPool(Header->ActualAddress);
+ if (PagedPool)
+ ExFreePagedPool(Header->ActualAddress);
+ else
+ ExFreeNonPagedPool(Header->ActualAddress);
}
/* EOF */
Modified: trunk/reactos/ntoskrnl/mm/pool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pool.c?rev=407…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/pool.c [iso-8859-1] Wed Apr 29 13:48:31 2009
@@ -58,7 +58,12 @@
{
if (KeGetCurrentIrql() > APC_LEVEL)
KeBugCheckEx(BAD_POOL_CALLER, 0x08, KeGetCurrentIrql(), PoolType, Tag);
- Block = ExAllocatePagedPoolWithTag(PoolType, NumberOfBytes, Tag);
+#ifdef DEBUG_PPOOL
+ if (ExpIsPoolTagDebuggable(Tag))
+ Block = ExpAllocateDebugPool(PoolType, NumberOfBytes, Tag, Caller, TRUE);
+ else
+#endif
+ Block = ExAllocatePagedPoolWithTag(PoolType, NumberOfBytes, Tag);
}
else
{
@@ -277,7 +282,12 @@
(ULONG_PTR)Block);
/* Free from paged pool */
- ExFreePagedPool(Block);
+#ifdef DEBUG_PPOOL
+ if (ExpIsPoolTagDebuggable(Tag))
+ ExpFreeDebugPool(Block, TRUE);
+ else
+#endif
+ ExFreePagedPool(Block);
}
/* Check for non-paged pool */
@@ -303,7 +313,7 @@
/* Free from non-paged pool */
#ifdef DEBUG_NPOOL
if (ExpIsPoolTagDebuggable(Tag))
- ExpFreeDebugPool(Block);
+ ExpFreeDebugPool(Block, FALSE);
else
#endif
ExFreeNonPagedPool(Block);