MdeModulePkg DxeCore: Return memory type from internal free pool/pages
The following patch for MemoryAttributesTable will need the memory type. And CoreUpdateProfile() can also use the memory type for check. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
@@ -1345,6 +1345,7 @@ CoreAllocatePages (
|
||||
|
||||
@param Memory Base address of memory being freed
|
||||
@param NumberOfPages The number of pages to free
|
||||
@param MemoryType Pointer to memory type
|
||||
|
||||
@retval EFI_NOT_FOUND Could not find the entry that covers the range
|
||||
@retval EFI_INVALID_PARAMETER Address not aligned
|
||||
@@ -1355,7 +1356,8 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
CoreInternalFreePages (
|
||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||
IN UINTN NumberOfPages
|
||||
IN UINTN NumberOfPages,
|
||||
OUT EFI_MEMORY_TYPE *MemoryType OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -1403,6 +1405,10 @@ CoreInternalFreePages (
|
||||
NumberOfPages += EFI_SIZE_TO_PAGES (Alignment) - 1;
|
||||
NumberOfPages &= ~(EFI_SIZE_TO_PAGES (Alignment) - 1);
|
||||
|
||||
if (MemoryType != NULL) {
|
||||
*MemoryType = Entry->Type;
|
||||
}
|
||||
|
||||
Status = CoreConvertPages (Memory, NumberOfPages, EfiConventionalMemory);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -1432,9 +1438,10 @@ CoreFreePages (
|
||||
IN UINTN NumberOfPages
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
EFI_MEMORY_TYPE MemoryType;
|
||||
|
||||
Status = CoreInternalFreePages (Memory, NumberOfPages);
|
||||
Status = CoreInternalFreePages (Memory, NumberOfPages, &MemoryType);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePages, (EFI_MEMORY_TYPE) 0, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) Memory);
|
||||
}
|
||||
|
Reference in New Issue
Block a user