Refactor big allocation tracker to use Tag
This commit is contained in:
@@ -33,8 +33,9 @@
|
|||||||
#define MM_POOL_INVALID_ALLOC_RUNLEVEL 8
|
#define MM_POOL_INVALID_ALLOC_RUNLEVEL 8
|
||||||
#define MM_POOL_INVALID_FREE_RUNLEVEL 9
|
#define MM_POOL_INVALID_FREE_RUNLEVEL 9
|
||||||
|
|
||||||
/* Big allocations entry flags */
|
/* Pool flags */
|
||||||
#define MM_POOL_BIG_ALLOCATIONS_ENTRY_FREE 0x1
|
#define MM_POOL_BIG_ALLOCATIONS_ENTRY_FREE 0x1
|
||||||
|
#define MM_POOL_RAISE_EXCEPTION 0x10
|
||||||
|
|
||||||
/* Number of reserved zeroed PTEs */
|
/* Number of reserved zeroed PTEs */
|
||||||
#define MM_RESERVED_ZERO_PTES 32
|
#define MM_RESERVED_ZERO_PTES 32
|
||||||
@@ -225,10 +226,10 @@ typedef struct _POOL_HEADER
|
|||||||
/* Pool descriptor structure definition */
|
/* Pool descriptor structure definition */
|
||||||
typedef struct _POOL_TRACKER_BIG_ALLOCATIONS
|
typedef struct _POOL_TRACKER_BIG_ALLOCATIONS
|
||||||
{
|
{
|
||||||
PVOID VirtualAddress;
|
|
||||||
ULONG Key;
|
|
||||||
ULONG NumberOfPages;
|
ULONG NumberOfPages;
|
||||||
PVOID QuotaObject;
|
PVOID QuotaObject;
|
||||||
|
ULONG Tag;
|
||||||
|
PVOID VirtualAddress;
|
||||||
} POOL_TRACKER_BIG_ALLOCATIONS, *PPOOL_TRACKER_BIG_ALLOCATIONS;
|
} POOL_TRACKER_BIG_ALLOCATIONS, *PPOOL_TRACKER_BIG_ALLOCATIONS;
|
||||||
|
|
||||||
#endif /* __XTDK_MMTYPES_H */
|
#endif /* __XTDK_MMTYPES_H */
|
||||||
|
|||||||
@@ -1282,8 +1282,8 @@ MM::Allocator::InitializeBigAllocationsTable(VOID)
|
|||||||
* @param VirtualAddress
|
* @param VirtualAddress
|
||||||
* Supplies the virtual address of the big allocation.
|
* Supplies the virtual address of the big allocation.
|
||||||
*
|
*
|
||||||
* @param Key
|
* @param Tag
|
||||||
* Supplies the key used to identify the allocation.
|
* Supplies the tag used to identify the allocation.
|
||||||
*
|
*
|
||||||
* @param NumberOfPages
|
* @param NumberOfPages
|
||||||
* Supplies the number of physical pages backing the allocation.
|
* Supplies the number of physical pages backing the allocation.
|
||||||
@@ -1298,7 +1298,7 @@ MM::Allocator::InitializeBigAllocationsTable(VOID)
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
XTAPI
|
XTAPI
|
||||||
MM::Allocator::RegisterBigAllocationTag(IN PVOID VirtualAddress,
|
MM::Allocator::RegisterBigAllocationTag(IN PVOID VirtualAddress,
|
||||||
IN ULONG Key,
|
IN ULONG Tag,
|
||||||
IN ULONG NumberOfPages,
|
IN ULONG NumberOfPages,
|
||||||
IN MMPOOL_TYPE PoolType)
|
IN MMPOOL_TYPE PoolType)
|
||||||
{
|
{
|
||||||
@@ -1336,8 +1336,8 @@ MM::Allocator::RegisterBigAllocationTag(IN PVOID VirtualAddress,
|
|||||||
if((ULONG_PTR)Entry->VirtualAddress & MM_POOL_BIG_ALLOCATIONS_ENTRY_FREE)
|
if((ULONG_PTR)Entry->VirtualAddress & MM_POOL_BIG_ALLOCATIONS_ENTRY_FREE)
|
||||||
{
|
{
|
||||||
/* Populate the available bucket with the allocation metadata */
|
/* Populate the available bucket with the allocation metadata */
|
||||||
Entry->Key = Key;
|
|
||||||
Entry->NumberOfPages = NumberOfPages;
|
Entry->NumberOfPages = NumberOfPages;
|
||||||
|
Entry->Tag = Tag;
|
||||||
Entry->VirtualAddress = VirtualAddress;
|
Entry->VirtualAddress = VirtualAddress;
|
||||||
|
|
||||||
/* Increment the global usage counter */
|
/* Increment the global usage counter */
|
||||||
@@ -1455,7 +1455,7 @@ MM::Allocator::UnregisterBigAllocationTag(IN PVOID VirtualAddress,
|
|||||||
{
|
{
|
||||||
/* Capture the allocation metadata */
|
/* Capture the allocation metadata */
|
||||||
*NumberOfPages = Entry->NumberOfPages;
|
*NumberOfPages = Entry->NumberOfPages;
|
||||||
PoolTag = Entry->Key;
|
PoolTag = Entry->Tag;
|
||||||
|
|
||||||
/* Invalidate the entry */
|
/* Invalidate the entry */
|
||||||
Entry->VirtualAddress = (PVOID)MM_POOL_BIG_ALLOCATIONS_ENTRY_FREE;
|
Entry->VirtualAddress = (PVOID)MM_POOL_BIG_ALLOCATIONS_ENTRY_FREE;
|
||||||
|
|||||||
Reference in New Issue
Block a user