mirror of https://github.com/acidanthera/audk.git
MdeModulePkg DxeCoreMemoryAllocationLib: Extend to support MemoryProfileLib
Cc: Jiewen Yao <jiewen.yao@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:
parent
022a9bf79c
commit
e273569285
|
@ -1,10 +1,10 @@
|
||||||
## @file
|
## @file
|
||||||
# Memory Allocation Library instance dedicated to DXE Core.
|
# Memory Allocation Library instance dedicated to DXE Core.
|
||||||
# The implementation borrows the DxeCore Memory Allocation services as the primitive
|
# The implementation borrows the DxeCore Memory Allocation services as the primitive
|
||||||
# for memory allocation instead of using UEFI boot servces in an indirect way.
|
# for memory allocation instead of using UEFI boot services in an indirect way.
|
||||||
# It is assumed that this library instance must be linked with DxeCore in this package.
|
# It is assumed that this library instance must be linked with DxeCore in this package.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
MODULE_TYPE = DXE_CORE
|
MODULE_TYPE = DXE_CORE
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
LIBRARY_CLASS = MemoryAllocationLib|DXE_CORE
|
LIBRARY_CLASS = MemoryAllocationLib|DXE_CORE
|
||||||
|
|
||||||
#
|
#
|
||||||
# The following information is for reference only and not required by the build tools.
|
# The following information is for reference only and not required by the build tools.
|
||||||
#
|
#
|
||||||
|
@ -34,13 +34,12 @@
|
||||||
[Sources]
|
[Sources]
|
||||||
MemoryAllocationLib.c
|
MemoryAllocationLib.c
|
||||||
DxeCoreMemoryAllocationServices.h
|
DxeCoreMemoryAllocationServices.h
|
||||||
|
DxeCoreMemoryProfileLibNull.c
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
DebugLib
|
DebugLib
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
// Memory Allocation Library instance dedicated to DXE Core.
|
// Memory Allocation Library instance dedicated to DXE Core.
|
||||||
//
|
//
|
||||||
// The implementation borrows the DxeCore Memory Allocation services as the primitive
|
// The implementation borrows the DxeCore Memory Allocation services as the primitive
|
||||||
// for memory allocation instead of using UEFI boot servces in an indirect way.
|
// for memory allocation instead of using UEFI boot services in an indirect way.
|
||||||
// It is assumed that this library instance must be linked with DxeCore in this package.
|
// It is assumed that this library instance must be linked with DxeCore in this package.
|
||||||
//
|
//
|
||||||
// Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
|
// Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
//
|
//
|
||||||
// This program and the accompanying materials
|
// This program and the accompanying materials
|
||||||
// are licensed and made available under the terms and conditions of the BSD License
|
// are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
## @file
|
||||||
|
# Memory Allocation/Profile Library instance dedicated to DXE Core.
|
||||||
|
# The implementation borrows the DxeCore Memory Allocation/profile services as the primitive
|
||||||
|
# for memory allocation/profile instead of using UEFI boot services or memory profile protocol in an indirect way.
|
||||||
|
# It is assumed that this library instance must be linked with DxeCore in this package.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials
|
||||||
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
##
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = DxeCoreMemoryAllocationProfileLib
|
||||||
|
MODULE_UNI_FILE = DxeCoreMemoryAllocationProfileLib.uni
|
||||||
|
FILE_GUID = 7ADD7147-74E8-4583-BE34-B6BC45353BB5
|
||||||
|
MODULE_TYPE = DXE_CORE
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
LIBRARY_CLASS = MemoryAllocationLib|DXE_CORE
|
||||||
|
LIBRARY_CLASS = MemoryProfileLib|DXE_CORE
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
MemoryAllocationLib.c
|
||||||
|
DxeCoreMemoryAllocationServices.h
|
||||||
|
DxeCoreMemoryProfileLib.c
|
||||||
|
DxeCoreMemoryProfileServices.h
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
DebugLib
|
||||||
|
BaseMemoryLib
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// /** @file
|
||||||
|
// Memory Allocation/Profile Library instance dedicated to DXE Core.
|
||||||
|
//
|
||||||
|
// The implementation borrows the DxeCore Memory Allocation/Profile services as the primitive
|
||||||
|
// for memory allocation/profile instead of using UEFI boot services or memory profile protocol in an indirect way.
|
||||||
|
// It is assumed that this library instance must be linked with DxeCore in this package.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
//
|
||||||
|
// This program and the accompanying materials
|
||||||
|
// are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
// which accompanies this distribution. The full text of the license may be found at
|
||||||
|
// http://opensource.org/licenses/bsd-license.php
|
||||||
|
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
//
|
||||||
|
// **/
|
||||||
|
|
||||||
|
|
||||||
|
#string STR_MODULE_ABSTRACT #language en-US "Memory Allocation/Profile Library instance dedicated to DXE Core"
|
||||||
|
|
||||||
|
#string STR_MODULE_DESCRIPTION #language en-US "The implementation borrows the DxeCore Memory Allocation/Profile services as the primitive for memory allocation/profile instead of using UEFI boot services or memory profile protocol in an indirect way. It is assumed that this library instance must be linked with DxeCore in this package."
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/** @file
|
||||||
|
Support routines for memory profile for DxeCore.
|
||||||
|
|
||||||
|
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
#include <PiDxe.h>
|
||||||
|
|
||||||
|
#include <Guid/MemoryProfile.h>
|
||||||
|
|
||||||
|
#include "DxeCoreMemoryProfileServices.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Record memory profile of multilevel caller.
|
||||||
|
|
||||||
|
@param[in] CallerAddress Address of caller.
|
||||||
|
@param[in] Action Memory profile action.
|
||||||
|
@param[in] MemoryType Memory type.
|
||||||
|
EfiMaxMemoryType means the MemoryType is unknown.
|
||||||
|
@param[in] Buffer Buffer address.
|
||||||
|
@param[in] Size Buffer size.
|
||||||
|
@param[in] ActionString String for memory profile action.
|
||||||
|
Only needed for user defined allocate action.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Memory profile is updated.
|
||||||
|
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||||
|
or memory profile for the image is not required,
|
||||||
|
or memory profile for the memory type is not required.
|
||||||
|
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||||
|
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||||
|
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||||
|
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
IN PHYSICAL_ADDRESS CallerAddress,
|
||||||
|
IN MEMORY_PROFILE_ACTION Action,
|
||||||
|
IN EFI_MEMORY_TYPE MemoryType,
|
||||||
|
IN VOID *Buffer,
|
||||||
|
IN UINTN Size,
|
||||||
|
IN CHAR8 *ActionString OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return CoreUpdateProfile (CallerAddress, Action, MemoryType, Size, Buffer, ActionString);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/** @file
|
||||||
|
Null routines for memory profile for DxeCore.
|
||||||
|
|
||||||
|
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
#include <PiDxe.h>
|
||||||
|
|
||||||
|
#include <Guid/MemoryProfile.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Record memory profile of multilevel caller.
|
||||||
|
|
||||||
|
@param[in] CallerAddress Address of caller.
|
||||||
|
@param[in] Action Memory profile action.
|
||||||
|
@param[in] MemoryType Memory type.
|
||||||
|
EfiMaxMemoryType means the MemoryType is unknown.
|
||||||
|
@param[in] Buffer Buffer address.
|
||||||
|
@param[in] Size Buffer size.
|
||||||
|
@param[in] ActionString String for memory profile action.
|
||||||
|
Only needed for user defined allocate action.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Memory profile is updated.
|
||||||
|
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||||
|
or memory profile for the image is not required,
|
||||||
|
or memory profile for the memory type is not required.
|
||||||
|
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||||
|
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||||
|
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||||
|
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
IN PHYSICAL_ADDRESS CallerAddress,
|
||||||
|
IN MEMORY_PROFILE_ACTION Action,
|
||||||
|
IN EFI_MEMORY_TYPE MemoryType,
|
||||||
|
IN VOID *Buffer,
|
||||||
|
IN UINTN Size,
|
||||||
|
IN CHAR8 *ActionString OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/** @file
|
||||||
|
Contains function prototypes for Memory Profile Services in DxeCore.
|
||||||
|
|
||||||
|
This header file borrows the DxeCore Memory Profile services as the primitive
|
||||||
|
for memory profile.
|
||||||
|
|
||||||
|
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _DXE_CORE_MEMORY_PROFILE_SERVICES_H_
|
||||||
|
#define _DXE_CORE_MEMORY_PROFILE_SERVICES_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
Update memory profile information.
|
||||||
|
|
||||||
|
@param CallerAddress Address of caller who call Allocate or Free.
|
||||||
|
@param Action This Allocate or Free action.
|
||||||
|
@param MemoryType Memory type.
|
||||||
|
EfiMaxMemoryType means the MemoryType is unknown.
|
||||||
|
@param Size Buffer size.
|
||||||
|
@param Buffer Buffer address.
|
||||||
|
@param ActionString String for memory profile action.
|
||||||
|
Only needed for user defined allocate action.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Memory profile is updated.
|
||||||
|
@return EFI_UNSUPPORTED Memory profile is unsupported,
|
||||||
|
or memory profile for the image is not required,
|
||||||
|
or memory profile for the memory type is not required.
|
||||||
|
@return EFI_ACCESS_DENIED It is during memory profile data getting.
|
||||||
|
@return EFI_ABORTED Memory profile recording is not enabled.
|
||||||
|
@return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
|
||||||
|
@return EFI_NOT_FOUND No matched allocate info found for free action.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
CoreUpdateProfile (
|
||||||
|
IN PHYSICAL_ADDRESS CallerAddress,
|
||||||
|
IN MEMORY_PROFILE_ACTION Action,
|
||||||
|
IN EFI_MEMORY_TYPE MemoryType,
|
||||||
|
IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool
|
||||||
|
IN VOID *Buffer,
|
||||||
|
IN CHAR8 *ActionString OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,8 +1,9 @@
|
||||||
/** @file
|
/** @file
|
||||||
Support routines for memory allocation routines based
|
Support routines for memory allocation routines based
|
||||||
on boot services for Dxe phase drivers.
|
on DxeCore Memory Allocation services for DxeCore,
|
||||||
|
with memory profile support.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -22,6 +23,8 @@
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include "DxeCoreMemoryAllocationServices.h"
|
#include "DxeCoreMemoryAllocationServices.h"
|
||||||
|
|
||||||
|
#include <Library/MemoryProfileLib.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocates one or more 4KB pages of a certain memory type.
|
Allocates one or more 4KB pages of a certain memory type.
|
||||||
|
|
||||||
|
@ -74,7 +77,20 @@ AllocatePages (
|
||||||
IN UINTN Pages
|
IN UINTN Pages
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocatePages (EfiBootServicesData, Pages);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocatePages (EfiBootServicesData, Pages);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES,
|
||||||
|
EfiBootServicesData,
|
||||||
|
Buffer,
|
||||||
|
EFI_PAGES_TO_SIZE (Pages),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +112,20 @@ AllocateRuntimePages (
|
||||||
IN UINTN Pages
|
IN UINTN Pages
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocatePages (EfiRuntimeServicesData, Pages);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocatePages (EfiRuntimeServicesData, Pages);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES,
|
||||||
|
EfiRuntimeServicesData,
|
||||||
|
Buffer,
|
||||||
|
EFI_PAGES_TO_SIZE (Pages),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,7 +147,20 @@ AllocateReservedPages (
|
||||||
IN UINTN Pages
|
IN UINTN Pages
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocatePages (EfiReservedMemoryType, Pages);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocatePages (EfiReservedMemoryType, Pages);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES,
|
||||||
|
EfiReservedMemoryType,
|
||||||
|
Buffer,
|
||||||
|
EFI_PAGES_TO_SIZE (Pages),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,7 +305,20 @@ AllocateAlignedPages (
|
||||||
IN UINTN Alignment
|
IN UINTN Alignment
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES,
|
||||||
|
EfiBootServicesData,
|
||||||
|
Buffer,
|
||||||
|
EFI_PAGES_TO_SIZE (Pages),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -291,7 +346,20 @@ AllocateAlignedRuntimePages (
|
||||||
IN UINTN Alignment
|
IN UINTN Alignment
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES,
|
||||||
|
EfiRuntimeServicesData,
|
||||||
|
Buffer,
|
||||||
|
EFI_PAGES_TO_SIZE (Pages),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -319,7 +387,20 @@ AllocateAlignedReservedPages (
|
||||||
IN UINTN Alignment
|
IN UINTN Alignment
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES,
|
||||||
|
EfiReservedMemoryType,
|
||||||
|
Buffer,
|
||||||
|
EFI_PAGES_TO_SIZE (Pages),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -402,7 +483,20 @@ AllocatePool (
|
||||||
IN UINTN AllocationSize
|
IN UINTN AllocationSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocatePool (EfiBootServicesData, AllocationSize);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocatePool (EfiBootServicesData, AllocationSize);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL,
|
||||||
|
EfiBootServicesData,
|
||||||
|
Buffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -423,7 +517,20 @@ AllocateRuntimePool (
|
||||||
IN UINTN AllocationSize
|
IN UINTN AllocationSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL,
|
||||||
|
EfiRuntimeServicesData,
|
||||||
|
Buffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -444,7 +551,20 @@ AllocateReservedPool (
|
||||||
IN UINTN AllocationSize
|
IN UINTN AllocationSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocatePool (EfiReservedMemoryType, AllocationSize);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocatePool (EfiReservedMemoryType, AllocationSize);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL,
|
||||||
|
EfiReservedMemoryType,
|
||||||
|
Buffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -495,7 +615,20 @@ AllocateZeroPool (
|
||||||
IN UINTN AllocationSize
|
IN UINTN AllocationSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateZeroPool (EfiBootServicesData, AllocationSize);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocateZeroPool (EfiBootServicesData, AllocationSize);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL,
|
||||||
|
EfiBootServicesData,
|
||||||
|
Buffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -517,7 +650,20 @@ AllocateRuntimeZeroPool (
|
||||||
IN UINTN AllocationSize
|
IN UINTN AllocationSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL,
|
||||||
|
EfiRuntimeServicesData,
|
||||||
|
Buffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -539,7 +685,20 @@ AllocateReservedZeroPool (
|
||||||
IN UINTN AllocationSize
|
IN UINTN AllocationSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_ZERO_POOL,
|
||||||
|
EfiReservedMemoryType,
|
||||||
|
Buffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -602,7 +761,20 @@ AllocateCopyPool (
|
||||||
IN CONST VOID *Buffer
|
IN CONST VOID *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);
|
VOID *NewBuffer;
|
||||||
|
|
||||||
|
NewBuffer = InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);
|
||||||
|
if (NewBuffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL,
|
||||||
|
EfiBootServicesData,
|
||||||
|
NewBuffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return NewBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -629,7 +801,20 @@ AllocateRuntimeCopyPool (
|
||||||
IN CONST VOID *Buffer
|
IN CONST VOID *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
|
VOID *NewBuffer;
|
||||||
|
|
||||||
|
NewBuffer = InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
|
||||||
|
if (NewBuffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL,
|
||||||
|
EfiRuntimeServicesData,
|
||||||
|
NewBuffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return NewBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -656,7 +841,20 @@ AllocateReservedCopyPool (
|
||||||
IN CONST VOID *Buffer
|
IN CONST VOID *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer);
|
VOID *NewBuffer;
|
||||||
|
|
||||||
|
NewBuffer = InternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer);
|
||||||
|
if (NewBuffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_COPY_POOL,
|
||||||
|
EfiRuntimeServicesData,
|
||||||
|
NewBuffer,
|
||||||
|
AllocationSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return NewBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -728,7 +926,20 @@ ReallocatePool (
|
||||||
IN VOID *OldBuffer OPTIONAL
|
IN VOID *OldBuffer OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL,
|
||||||
|
EfiBootServicesData,
|
||||||
|
Buffer,
|
||||||
|
NewSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -760,7 +971,20 @@ ReallocateRuntimePool (
|
||||||
IN VOID *OldBuffer OPTIONAL
|
IN VOID *OldBuffer OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL,
|
||||||
|
EfiRuntimeServicesData,
|
||||||
|
Buffer,
|
||||||
|
NewSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -792,7 +1016,20 @@ ReallocateReservedPool (
|
||||||
IN VOID *OldBuffer OPTIONAL
|
IN VOID *OldBuffer OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalReallocatePool (EfiReservedMemoryType, OldSize, NewSize, OldBuffer);
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Buffer = InternalReallocatePool (EfiReservedMemoryType, OldSize, NewSize, OldBuffer);
|
||||||
|
if (Buffer != NULL) {
|
||||||
|
MemoryProfileLibRecord (
|
||||||
|
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
|
||||||
|
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL,
|
||||||
|
EfiReservedMemoryType,
|
||||||
|
Buffer,
|
||||||
|
NewSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -261,6 +261,7 @@
|
||||||
MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||||
MdeModulePkg/Library/UefiMemoryAllocationProfileLib/UefiMemoryAllocationProfileLib.inf
|
MdeModulePkg/Library/UefiMemoryAllocationProfileLib/UefiMemoryAllocationProfileLib.inf
|
||||||
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
|
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
|
||||||
|
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationProfileLib.inf
|
||||||
MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
|
MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
|
||||||
MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
|
MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
|
||||||
MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
|
MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
|
||||||
|
|
Loading…
Reference in New Issue