mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[NTOS] Revert pool debugging code
Revert "[NTOS] On DBG builds, fill pool allocations with 0xCD and freed pool with 0xDD" This reverts commit24f240be8a
. Revert "[NTOS] Add compile time option to trace callers of pool allocations" This reverts commit8b20755040
. Revert "WIP" This reverts commit8cfd5c601f
.
This commit is contained in:
parent
1f8dcf3c0e
commit
21647e2c4e
2 changed files with 15 additions and 92 deletions
|
@ -22,10 +22,6 @@
|
|||
|
||||
#define POOL_BIG_TABLE_ENTRY_FREE 0x1
|
||||
|
||||
/* DEBUGGING ******************************************************************/
|
||||
|
||||
//#define DBG_NUMBER_OF_FRAMES_TO_CAPTURE 5
|
||||
|
||||
typedef struct _POOL_DPC_CONTEXT
|
||||
{
|
||||
PPOOL_TRACKER_TABLE PoolTrackTable;
|
||||
|
@ -1851,14 +1847,9 @@ ExReturnPoolQuota(IN PVOID P)
|
|||
*/
|
||||
PVOID
|
||||
NTAPI
|
||||
#ifdef DBG_NUMBER_OF_FRAMES_TO_CAPTURE
|
||||
ExAllocatePoolWithTagInternal(
|
||||
#else
|
||||
ExAllocatePoolWithTag(
|
||||
#endif
|
||||
_In_ POOL_TYPE PoolType,
|
||||
_In_ SIZE_T NumberOfBytes,
|
||||
_In_ ULONG Tag)
|
||||
ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
||||
IN SIZE_T NumberOfBytes,
|
||||
IN ULONG Tag)
|
||||
{
|
||||
PPOOL_DESCRIPTOR PoolDesc;
|
||||
PLIST_ENTRY ListHead;
|
||||
|
@ -1868,7 +1859,6 @@ ExAllocatePoolWithTag(
|
|||
ULONG OriginalType;
|
||||
PKPRCB Prcb = KeGetCurrentPrcb();
|
||||
PGENERAL_LOOKASIDE LookasideList;
|
||||
PVOID Allocation;
|
||||
|
||||
//
|
||||
// Some sanity checks
|
||||
|
@ -1908,13 +1898,10 @@ ExAllocatePoolWithTag(
|
|||
if (MmUseSpecialPool(NumberOfBytes, Tag))
|
||||
{
|
||||
//
|
||||
// Try to allocate using special pool (initialized with random byte)
|
||||
// Try to allocate using special pool
|
||||
//
|
||||
Allocation = MmAllocateSpecialPool(NumberOfBytes, Tag, PoolType, 2);
|
||||
if (Allocation != NULL)
|
||||
{
|
||||
return Allocation;
|
||||
}
|
||||
Entry = MmAllocateSpecialPool(NumberOfBytes, Tag, PoolType, 2);
|
||||
if (Entry) return Entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1935,8 +1922,8 @@ ExAllocatePoolWithTag(
|
|||
//
|
||||
// Allocate pages for it
|
||||
//
|
||||
Allocation = MiAllocatePoolPages(OriginalType, NumberOfBytes);
|
||||
if (Allocation == NULL)
|
||||
Entry = MiAllocatePoolPages(OriginalType, NumberOfBytes);
|
||||
if (!Entry)
|
||||
{
|
||||
#if DBG
|
||||
//
|
||||
|
@ -2008,7 +1995,7 @@ ExAllocatePoolWithTag(
|
|||
// Add a tag for the big page allocation and switch to the generic "BIG"
|
||||
// tag if we failed to do so, then insert a tracker for this alloation.
|
||||
//
|
||||
if (!ExpAddTagForBigPages(Allocation,
|
||||
if (!ExpAddTagForBigPages(Entry,
|
||||
Tag,
|
||||
(ULONG)BYTES_TO_PAGES(NumberOfBytes),
|
||||
OriginalType))
|
||||
|
@ -2016,10 +2003,7 @@ ExAllocatePoolWithTag(
|
|||
Tag = ' GIB';
|
||||
}
|
||||
ExpInsertPoolTracker(Tag, ROUND_TO_PAGES(NumberOfBytes), OriginalType);
|
||||
#if DBG
|
||||
RtlFillMemory(Allocation, NumberOfBytes, 0xCD);
|
||||
#endif
|
||||
return Allocation;
|
||||
return Entry;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2089,11 +2073,7 @@ ExAllocatePoolWithTag(
|
|||
Entry->PoolTag = Tag;
|
||||
(POOL_FREE_BLOCK(Entry))->Flink = NULL;
|
||||
(POOL_FREE_BLOCK(Entry))->Blink = NULL;
|
||||
Allocation = POOL_FREE_BLOCK(Entry);
|
||||
#if DBG
|
||||
RtlFillMemory(Allocation, NumberOfBytes, 0xCD);
|
||||
#endif
|
||||
return Allocation;
|
||||
return POOL_FREE_BLOCK(Entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2277,11 +2257,7 @@ ExAllocatePoolWithTag(
|
|||
Entry->PoolTag = Tag;
|
||||
(POOL_FREE_BLOCK(Entry))->Flink = NULL;
|
||||
(POOL_FREE_BLOCK(Entry))->Blink = NULL;
|
||||
Allocation = POOL_FREE_BLOCK(Entry);
|
||||
#if DBG
|
||||
RtlFillMemory(Allocation, NumberOfBytes, 0xCD);
|
||||
#endif
|
||||
return Allocation;
|
||||
return POOL_FREE_BLOCK(Entry);
|
||||
}
|
||||
} while (++ListHead != &PoolDesc->ListHeads[POOL_LISTS_PER_PAGE]);
|
||||
|
||||
|
@ -2424,38 +2400,9 @@ ExAllocatePoolWithTag(
|
|||
//
|
||||
ExpCheckPoolBlocks(Entry);
|
||||
Entry->PoolTag = Tag;
|
||||
Allocation = POOL_FREE_BLOCK(Entry);
|
||||
|
||||
return Allocation;
|
||||
return POOL_FREE_BLOCK(Entry);
|
||||
}
|
||||
|
||||
#ifdef DBG_NUMBER_OF_FRAMES_TO_CAPTURE
|
||||
PVOID
|
||||
NTAPI
|
||||
ExAllocatePoolWithTag(
|
||||
_In_ POOL_TYPE PoolType,
|
||||
_In_ SIZE_T NumberOfBytes,
|
||||
_In_ ULONG Tag)
|
||||
{
|
||||
SIZE_T FullSize;
|
||||
PVOID Allocation, *DbgData;
|
||||
|
||||
/* Allocate a larger chunk to add the debug data */
|
||||
FullSize = NumberOfBytes + (DBG_NUMBER_OF_FRAMES_TO_CAPTURE + 2) * sizeof(PVOID);
|
||||
Allocation = ExAllocatePoolWithTagInternal(PoolType, FullSize, Tag);
|
||||
if (Allocation == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Append the debug data, separated by a '####' */
|
||||
DbgData = ALIGN_UP_POINTER_BY((PUCHAR)Allocation + NumberOfBytes, sizeof(PVOID));
|
||||
DbgData[0] = (PVOID)(ULONG_PTR)'####';
|
||||
RtlWalkFrameChain(&DbgData[1], DBG_NUMBER_OF_FRAMES_TO_CAPTURE, 0);
|
||||
return Allocation;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -2597,10 +2544,6 @@ ExFreePoolWithTag(IN PVOID P,
|
|||
Tag &= ~PROTECTED_POOL;
|
||||
}
|
||||
|
||||
#if DBG
|
||||
RtlFillMemory(P, PageCount * PAGE_SIZE, 0xDD);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Check block tag
|
||||
//
|
||||
|
@ -2726,10 +2669,6 @@ ExFreePoolWithTag(IN PVOID P,
|
|||
}
|
||||
}
|
||||
|
||||
#if DBG
|
||||
RtlFillMemory(P, BlockSize * POOL_BLOCK_SIZE - sizeof(*Entry), 0xDD);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Is this allocation small enough to have come from a lookaside list?
|
||||
//
|
||||
|
|
|
@ -665,9 +665,6 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType,
|
|||
//
|
||||
// Return the allocation address to the caller
|
||||
//
|
||||
#if DBG
|
||||
RtlFillMemoryUlong(BaseVa, ROUND_TO_PAGES(SizeInBytes), 0xABABABAB);
|
||||
#endif
|
||||
return BaseVa;
|
||||
}
|
||||
|
||||
|
@ -677,13 +674,7 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType,
|
|||
if ((SizeInPages == 1) && (ExQueryDepthSList(&MiNonPagedPoolSListHead)))
|
||||
{
|
||||
BaseVa = InterlockedPopEntrySList(&MiNonPagedPoolSListHead);
|
||||
if (BaseVa)
|
||||
{
|
||||
#if DBG
|
||||
RtlFillMemoryUlong(BaseVa, ROUND_TO_PAGES(SizeInBytes), 0xABABABAB);
|
||||
#endif
|
||||
return BaseVa;
|
||||
}
|
||||
if (BaseVa) return BaseVa;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -811,9 +802,6 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType,
|
|||
// Release the nonpaged pool lock, and return the allocation
|
||||
//
|
||||
KeReleaseQueuedSpinLock(LockQueueMmNonPagedPoolLock, OldIrql);
|
||||
#if DBG
|
||||
RtlFillMemoryUlong(BaseVa, ROUND_TO_PAGES(SizeInBytes), 0xABABABAB);
|
||||
#endif
|
||||
return BaseVa;
|
||||
}
|
||||
|
||||
|
@ -909,11 +897,7 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType,
|
|||
//
|
||||
// Return the address
|
||||
//
|
||||
BaseVa = MiPteToAddress(StartPte);
|
||||
#if DBG
|
||||
RtlFillMemoryUlong(BaseVa, ROUND_TO_PAGES(SizeInBytes), 0xABABABAB);
|
||||
#endif
|
||||
return BaseVa;
|
||||
return MiPteToAddress(StartPte);
|
||||
}
|
||||
|
||||
ULONG
|
||||
|
|
Loading…
Reference in a new issue