Replace inline pool tags with definitions
This commit is contained in:
@@ -409,7 +409,7 @@ HL::FrameBuffer::EnableShadowBuffer(VOID)
|
|||||||
|
|
||||||
/* Allocate non-paged memory for the shadow buffer */
|
/* Allocate non-paged memory for the shadow buffer */
|
||||||
Status = MM::Allocator::AllocatePool(NonPagedPool, FrameBufferSize,
|
Status = MM::Allocator::AllocatePool(NonPagedPool, FrameBufferSize,
|
||||||
&ScreenShadowBuffer, SIGNATURE32('F', 'B', 'U', 'F'));
|
&ScreenShadowBuffer, TAG_HL_FRAMEBUFFER);
|
||||||
if(Status != STATUS_SUCCESS)
|
if(Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Allocation failed, return status code */
|
/* Allocation failed, return status code */
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ MM::Allocator::AllocatePool(IN MMPOOL_TYPE PoolType,
|
|||||||
OUT PVOID *Memory)
|
OUT PVOID *Memory)
|
||||||
{
|
{
|
||||||
/* Allocate pool */
|
/* Allocate pool */
|
||||||
return AllocatePool(PoolType, Bytes, Memory, SIGNATURE32('N', 'o', 'n', 'e'));
|
return AllocatePool(PoolType, Bytes, Memory, TAG_MM_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -351,7 +351,7 @@ MM::Allocator::AllocatePool(IN MMPOOL_TYPE PoolType,
|
|||||||
if(!RegisterBigAllocationTag(PoolEntry, Tag, (ULONG)SIZE_TO_PAGES(Bytes), PoolType))
|
if(!RegisterBigAllocationTag(PoolEntry, Tag, (ULONG)SIZE_TO_PAGES(Bytes), PoolType))
|
||||||
{
|
{
|
||||||
/* Fallback to a default tag */
|
/* Fallback to a default tag */
|
||||||
Tag = SIGNATURE32('B', 'i', 'g', 'A');
|
Tag = TAG_MM_BIG_ALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register the allocation in the tracking table */
|
/* Register the allocation in the tracking table */
|
||||||
@@ -721,8 +721,8 @@ MM::Allocator::ExpandBigAllocationsTable(VOID)
|
|||||||
FreePages(OldTable, &PagesFreed);
|
FreePages(OldTable, &PagesFreed);
|
||||||
|
|
||||||
/* Update the pool tracking statistics */
|
/* Update the pool tracking statistics */
|
||||||
UnregisterAllocationTag(SIGNATURE32('M', 'M', 'g', 'r'), PagesFreed << MM_PAGE_SHIFT, (MMPOOL_TYPE)0);
|
UnregisterAllocationTag(TAG_MM_MEMORY_MGR, PagesFreed << MM_PAGE_SHIFT, (MMPOOL_TYPE)0);
|
||||||
RegisterAllocationTag(SIGNATURE32('M', 'M', 'g', 'r'), ROUND_UP(AllocationBytes, MM_PAGE_SIZE), (MMPOOL_TYPE)0);
|
RegisterAllocationTag(TAG_MM_MEMORY_MGR, ROUND_UP(AllocationBytes, MM_PAGE_SIZE), (MMPOOL_TYPE)0);
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1068,7 +1068,7 @@ XTSTATUS
|
|||||||
MM::Allocator::FreePool(IN PVOID VirtualAddress)
|
MM::Allocator::FreePool(IN PVOID VirtualAddress)
|
||||||
{
|
{
|
||||||
/* Free pool */
|
/* Free pool */
|
||||||
return FreePool(VirtualAddress, SIGNATURE32('N', 'o', 'n', 'e'));
|
return FreePool(VirtualAddress, TAG_MM_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1116,7 +1116,7 @@ MM::Allocator::FreePool(IN PVOID VirtualAddress,
|
|||||||
else if(!Tag)
|
else if(!Tag)
|
||||||
{
|
{
|
||||||
/* Fallback to a default tag */
|
/* Fallback to a default tag */
|
||||||
Tag = SIGNATURE32('B', 'i', 'g', 'A');
|
Tag = TAG_MM_BIG_ALLOC;
|
||||||
PageCount = 1;
|
PageCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1500,7 +1500,7 @@ MM::Allocator::InitializeBigAllocationsTracking(VOID)
|
|||||||
KE::SpinLock::InitializeSpinLock(&BigAllocationsTrackingTableLock);
|
KE::SpinLock::InitializeSpinLock(&BigAllocationsTrackingTableLock);
|
||||||
|
|
||||||
/* Register the allocation in the tracking table */
|
/* Register the allocation in the tracking table */
|
||||||
RegisterAllocationTag(SIGNATURE32('M', 'M', 'g', 'r'),
|
RegisterAllocationTag(TAG_MM_MEMORY_MGR,
|
||||||
SIZE_TO_PAGES(BigAllocationsTrackingTableSize * sizeof(POOL_TRACKING_BIG_ALLOCATIONS)),
|
SIZE_TO_PAGES(BigAllocationsTrackingTableSize * sizeof(POOL_TRACKING_BIG_ALLOCATIONS)),
|
||||||
NonPagedPool);
|
NonPagedPool);
|
||||||
}
|
}
|
||||||
@@ -1520,10 +1520,10 @@ MM::Allocator::PopulateAllocationTags(VOID)
|
|||||||
|
|
||||||
CULONG HotTags[] =
|
CULONG HotTags[] =
|
||||||
{
|
{
|
||||||
SIGNATURE32('B', 'i', 'g', 'A'), /* Big Allocations */
|
TAG_MM_BIG_ALLOC, /* Big Allocations */
|
||||||
SIGNATURE32('M', 'M', 'g', 'r'), /* Memory Manager Internal */
|
TAG_MM_MEMORY_MGR, /* Memory Manager Internal */
|
||||||
SIGNATURE32('N', 'o', 'n', 'e'), /* Untagged allocations */
|
TAG_MM_NONE, /* Untagged allocations */
|
||||||
SIGNATURE32('O', 'v', 'f', 'l'), /* Global table expansion overflow fallback */
|
TAG_MM_OVERFLOW, /* Global table expansion overflow fallback */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Seed all tags */
|
/* Seed all tags */
|
||||||
@@ -1754,7 +1754,7 @@ MM::Allocator::RegisterAllocationTagExpansion(IN ULONG Tag,
|
|||||||
if(Status != STATUS_SUCCESS || !NewTrackingTable)
|
if(Status != STATUS_SUCCESS || !NewTrackingTable)
|
||||||
{
|
{
|
||||||
/* Activate the global overflow bucket */
|
/* Activate the global overflow bucket */
|
||||||
AllocationsTrackingTable[AllocationsTrackingTableSize - 1].Tag = SIGNATURE32('O', 'v', 'f', 'l');
|
AllocationsTrackingTable[AllocationsTrackingTableSize - 1].Tag = TAG_MM_OVERFLOW;
|
||||||
UseOverflowBucket = TRUE;
|
UseOverflowBucket = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1775,7 +1775,7 @@ MM::Allocator::RegisterAllocationTagExpansion(IN ULONG Tag,
|
|||||||
AllocationsTrackingExpansionTableSize = Footprint / sizeof(POOL_TRACKING_TABLE);;
|
AllocationsTrackingExpansionTableSize = Footprint / sizeof(POOL_TRACKING_TABLE);;
|
||||||
|
|
||||||
/* Register the new allocation tag */
|
/* Register the new allocation tag */
|
||||||
RegisterAllocationTag(SIGNATURE32('M', 'M', 'g', 'r'), Footprint, NonPagedPool);
|
RegisterAllocationTag(TAG_MM_MEMORY_MGR, Footprint, NonPagedPool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1809,7 +1809,7 @@ MM::Allocator::RegisterAllocationTagExpansion(IN ULONG Tag,
|
|||||||
{
|
{
|
||||||
/* Free the old tracking table and unregister the allocation tag */
|
/* Free the old tracking table and unregister the allocation tag */
|
||||||
FreePages(OldTrackingTable, &FreedPages);
|
FreePages(OldTrackingTable, &FreedPages);
|
||||||
UnregisterAllocationTag(SIGNATURE32('M', 'M', 'g', 'r'), (SIZE_T)FreedPages * MM_PAGE_SIZE, NonPagedPool);
|
UnregisterAllocationTag(TAG_MM_MEMORY_MGR, (SIZE_T)FreedPages * MM_PAGE_SIZE, NonPagedPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register the caller's original allocation */
|
/* Register the caller's original allocation */
|
||||||
@@ -2181,5 +2181,5 @@ MM::Allocator::UnregisterBigAllocationTag(IN PVOID VirtualAddress,
|
|||||||
|
|
||||||
/* Return an empty page count and a fallback tag */
|
/* Return an empty page count and a fallback tag */
|
||||||
*Pages = 0;
|
*Pages = 0;
|
||||||
return SIGNATURE32('B', 'i', 'g', 'A');
|
return TAG_MM_BIG_ALLOC;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ MM::Manager::GetPhysicalMemoryBlock(VOID)
|
|||||||
sizeof(PHYSICAL_MEMORY_RUN) *
|
sizeof(PHYSICAL_MEMORY_RUN) *
|
||||||
(DescriptorCount - 1),
|
(DescriptorCount - 1),
|
||||||
(PVOID*)&PrimaryBuffer,
|
(PVOID*)&PrimaryBuffer,
|
||||||
SIGNATURE32('M', 'M', 'g', 'r'));
|
TAG_MM_MEMORY_MGR);
|
||||||
if(Status != STATUS_SUCCESS || !PrimaryBuffer)
|
if(Status != STATUS_SUCCESS || !PrimaryBuffer)
|
||||||
{
|
{
|
||||||
/* Primary pool allocation failed, return NULLPTR */
|
/* Primary pool allocation failed, return NULLPTR */
|
||||||
@@ -197,14 +197,14 @@ MM::Manager::GetPhysicalMemoryBlock(VOID)
|
|||||||
sizeof(PHYSICAL_MEMORY_RUN) *
|
sizeof(PHYSICAL_MEMORY_RUN) *
|
||||||
(RunCount - 1),
|
(RunCount - 1),
|
||||||
(PVOID*)&SecondaryBuffer,
|
(PVOID*)&SecondaryBuffer,
|
||||||
SIGNATURE32('M', 'M', 'g', 'r'));
|
TAG_MM_MEMORY_MGR);
|
||||||
if(Status == STATUS_SUCCESS && SecondaryBuffer)
|
if(Status == STATUS_SUCCESS && SecondaryBuffer)
|
||||||
{
|
{
|
||||||
/* Copy the coalesced runs from the oversized primary buffer */
|
/* Copy the coalesced runs from the oversized primary buffer */
|
||||||
RtlCopyMemory(SecondaryBuffer->Run, PrimaryBuffer->Run, sizeof(PHYSICAL_MEMORY_RUN) * RunCount);
|
RtlCopyMemory(SecondaryBuffer->Run, PrimaryBuffer->Run, sizeof(PHYSICAL_MEMORY_RUN) * RunCount);
|
||||||
|
|
||||||
/* Free the primary buffer */
|
/* Free the primary buffer */
|
||||||
MM::Allocator::FreePool(PrimaryBuffer, SIGNATURE32('M', 'M', 'g', 'r'));
|
MM::Allocator::FreePool(PrimaryBuffer, TAG_MM_MEMORY_MGR);
|
||||||
|
|
||||||
/* Update the primary buffer pointer */
|
/* Update the primary buffer pointer */
|
||||||
PrimaryBuffer = SecondaryBuffer;
|
PrimaryBuffer = SecondaryBuffer;
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ MM::Pfn::InitializePfnBitmap(VOID)
|
|||||||
Status = MM::Allocator::AllocatePool(NonPagedPool,
|
Status = MM::Allocator::AllocatePool(NonPagedPool,
|
||||||
(((HighestPhysicalPage + 1) + 31) / 32) * 4,
|
(((HighestPhysicalPage + 1) + 31) / 32) * 4,
|
||||||
(PVOID *)&BitMap,
|
(PVOID *)&BitMap,
|
||||||
SIGNATURE32('M', 'M', 'g', 'r'));
|
TAG_MM_MEMORY_MGR);
|
||||||
if(Status != STATUS_SUCCESS || !BitMap)
|
if(Status != STATUS_SUCCESS || !BitMap)
|
||||||
{
|
{
|
||||||
/* Memory allocation failed, kernel panic */
|
/* Memory allocation failed, kernel panic */
|
||||||
|
|||||||
Reference in New Issue
Block a user