TianoCore EDK2 master
|
Go to the source code of this file.
Data Structures | |
struct | MEMORY_PROFILE_CONTEXT_DATA |
struct | MEMORY_PROFILE_DRIVER_INFO_DATA |
struct | MEMORY_PROFILE_ALLOC_INFO_DATA |
Macros | |
#define | IS_UEFI_MEMORY_PROFILE_ENABLED ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) |
#define | GET_OCCUPIED_SIZE(ActualSize, Alignment) ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))) |
Support routines for UEFI memory profile.
Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file MemoryProfileRecord.c.
#define GET_OCCUPIED_SIZE | ( | ActualSize, | |
Alignment | |||
) | ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))) |
Definition at line 14 of file MemoryProfileRecord.c.
#define IS_UEFI_MEMORY_PROFILE_ENABLED ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) |
Definition at line 12 of file MemoryProfileRecord.c.
MEMORY_PROFILE_DRIVER_INFO_DATA * BuildDriverInfo | ( | IN MEMORY_PROFILE_CONTEXT_DATA * | ContextData, |
IN EFI_GUID * | FileName, | ||
IN PHYSICAL_ADDRESS | ImageBase, | ||
IN UINT64 | ImageSize, | ||
IN PHYSICAL_ADDRESS | EntryPoint, | ||
IN UINT16 | ImageSubsystem, | ||
IN EFI_FV_FILETYPE | FileType | ||
) |
Build driver info.
ContextData | Memory profile context. |
FileName | File name of the image. |
ImageBase | Image base address. |
ImageSize | Image size. |
EntryPoint | Entry point of the image. |
ImageSubsystem | Image subsystem of the image. |
FileType | File type of the image. |
Definition at line 369 of file MemoryProfileRecord.c.
VOID CoreAcquireMemoryProfileLock | ( | VOID | ) |
Acquire lock on mMemoryProfileLock.
Definition at line 218 of file MemoryProfileRecord.c.
BOOLEAN CoreNeedRecordProfile | ( | IN EFI_MEMORY_TYPE | MemoryType | ) |
Return if this memory type needs to be recorded into memory profile. If BIOS memory type (0 ~ EfiMaxMemoryType - 1), it checks bit (1 << MemoryType). If OS memory type (0x80000000 ~ 0xFFFFFFFF), it checks bit63 - 0x8000000000000000. If OEM memory type (0x70000000 ~ 0x7FFFFFFF), it checks bit62 - 0x4000000000000000.
MemoryType | Memory type. |
TRUE | This memory type need to be recorded. |
FALSE | This memory type need not to be recorded. |
Definition at line 913 of file MemoryProfileRecord.c.
VOID CoreReleaseMemoryProfileLock | ( | VOID | ) |
Release lock on mMemoryProfileLock.
Definition at line 229 of file MemoryProfileRecord.c.
EFI_STATUS EFIAPI CoreUpdateProfile | ( | IN PHYSICAL_ADDRESS | CallerAddress, |
IN MEMORY_PROFILE_ACTION | Action, | ||
IN EFI_MEMORY_TYPE | MemoryType, | ||
IN UINTN | Size, | ||
IN VOID * | Buffer, | ||
IN CHAR8 *ActionString | OPTIONAL | ||
) |
Update memory profile information.
CallerAddress | Address of caller who call Allocate or Free. |
Action | This Allocate or Free action. |
MemoryType | Memory type. EfiMaxMemoryType means the MemoryType is unknown. |
Size | Buffer size. |
Buffer | Buffer address. |
ActionString | String for memory profile action. Only needed for user defined allocate action. |
Definition at line 1357 of file MemoryProfileRecord.c.
EFI_STATUS CoreUpdateProfileAllocate | ( | IN PHYSICAL_ADDRESS | CallerAddress, |
IN MEMORY_PROFILE_ACTION | Action, | ||
IN EFI_MEMORY_TYPE | MemoryType, | ||
IN UINTN | Size, | ||
IN VOID * | Buffer, | ||
IN CHAR8 *ActionString | OPTIONAL | ||
) |
Update memory profile Allocate information.
CallerAddress | Address of caller who call Allocate. |
Action | This Allocate action. |
MemoryType | Memory type. |
Size | Buffer size. |
Buffer | Buffer address. |
ActionString | String for memory profile action. |
Definition at line 976 of file MemoryProfileRecord.c.
EFI_STATUS CoreUpdateProfileFree | ( | IN PHYSICAL_ADDRESS | CallerAddress, |
IN MEMORY_PROFILE_ACTION | Action, | ||
IN UINTN | Size, | ||
IN VOID * | Buffer | ||
) |
Update memory profile Free information.
CallerAddress | Address of caller who call Free. |
Action | This Free action. |
Size | Buffer size. |
Buffer | Buffer address. |
Definition at line 1173 of file MemoryProfileRecord.c.
EFI_GUID * GetFileNameFromFilePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Get the GUID file name from the file path.
FilePath | File path. |
Definition at line 658 of file MemoryProfileRecord.c.
MEMORY_PROFILE_ALLOC_INFO_DATA * GetMemoryProfileAllocInfoFromAddress | ( | IN MEMORY_PROFILE_DRIVER_INFO_DATA * | DriverInfoData, |
IN MEMORY_PROFILE_ACTION | BasicAction, | ||
IN UINTN | Size, | ||
IN VOID * | Buffer | ||
) |
Get memory profile alloc info from memory profile.
DriverInfoData | Driver info. |
BasicAction | This Free basic action. |
Size | Buffer size. |
Buffer | Buffer address. |
Definition at line 1106 of file MemoryProfileRecord.c.
MEMORY_PROFILE_CONTEXT_DATA * GetMemoryProfileContext | ( | VOID | ) |
Return memory profile context.
Definition at line 243 of file MemoryProfileRecord.c.
MEMORY_PROFILE_DRIVER_INFO_DATA * GetMemoryProfileDriverInfoByFileNameAndAddress | ( | IN MEMORY_PROFILE_CONTEXT_DATA * | ContextData, |
IN EFI_GUID * | FileName, | ||
IN PHYSICAL_ADDRESS | Address | ||
) |
Search image from memory profile.
ContextData | Memory profile context. |
FileName | Image file name. |
Address | Image Address. |
Definition at line 742 of file MemoryProfileRecord.c.
MEMORY_PROFILE_DRIVER_INFO_DATA * GetMemoryProfileDriverInfoFromAddress | ( | IN MEMORY_PROFILE_CONTEXT_DATA * | ContextData, |
IN PHYSICAL_ADDRESS | Address | ||
) |
Search image from memory profile. It will return image, if (Address >= ImageBuffer) AND (Address < ImageBuffer + ImageSize).
ContextData | Memory profile context. |
Address | Image or Function address. |
Definition at line 788 of file MemoryProfileRecord.c.
UINTN GetProfileMemoryIndex | ( | IN EFI_MEMORY_TYPE | MemoryType | ) |
Convert EFI memory type to profile memory index. The rule is: If BIOS memory type (0 ~ EfiMaxMemoryType - 1), ProfileMemoryIndex = MemoryType. If OS memory type (0x80000000 ~ 0xFFFFFFFF), ProfileMemoryIndex = EfiMaxMemoryType. If OEM memory type (0x70000000 ~ 0x7FFFFFFF), ProfileMemoryIndex = EfiMaxMemoryType + 1.
MemoryType | Memory type. |
Definition at line 946 of file MemoryProfileRecord.c.
Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded into system memory with the PE/COFF Loader Library functions.
Retrieves the entry point to the PE/COFF image specified by Pe32Data and returns this entry point in EntryPoint. If the entry point could not be retrieved from the PE/COFF image, then return RETURN_INVALID_PARAMETER. Otherwise return RETURN_SUCCESS. If Pe32Data is NULL, then ASSERT(). If EntryPoint is NULL, then ASSERT().
Pe32Data | The pointer to the PE/COFF image that is loaded in system memory. |
EntryPoint | The pointer to entry point to the PE/COFF image to return. |
RETURN_SUCCESS | EntryPoint was returned. |
RETURN_INVALID_PARAMETER | The entry point could not be found in the PE/COFF image. |
Definition at line 315 of file MemoryProfileRecord.c.
UINT16 InternalPeCoffGetSubsystem | ( | IN VOID * | Pe32Data | ) |
Retrieves and returns the Subsystem of a PE/COFF image that has been loaded into system memory. If Pe32Data is NULL, then ASSERT().
Pe32Data | The pointer to the PE/COFF image that is loaded in system memory. |
Definition at line 260 of file MemoryProfileRecord.c.
VOID MemoryProfileCopyData | ( | IN VOID * | ProfileBuffer | ) |
Copy memory profile data.
ProfileBuffer | The buffer to hold memory profile data. |
Definition at line 1496 of file MemoryProfileRecord.c.
UINTN MemoryProfileGetDataSize | ( | VOID | ) |
Get memory profile data size.
Definition at line 1438 of file MemoryProfileRecord.c.
VOID MemoryProfileInit | ( | IN VOID * | HobStart | ) |
Initialize memory profile.
HobStart | The start address of the HOB. |
Definition at line 592 of file MemoryProfileRecord.c.
VOID MemoryProfileInstallProtocol | ( | VOID | ) |
Install memory profile protocol.
Definition at line 628 of file MemoryProfileRecord.c.
BOOLEAN NeedRecordThisDriver | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DriverFilePath | ) |
Return if record for this driver is needed..
DriverFilePath | Driver file path. |
TRUE | Record for this driver is needed. |
FALSE | Record for this driver is not needed. |
Definition at line 469 of file MemoryProfileRecord.c.
EFI_STATUS EFIAPI ProfileProtocolGetData | ( | IN EDKII_MEMORY_PROFILE_PROTOCOL * | This, |
IN OUT UINT64 * | ProfileSize, | ||
OUT VOID * | ProfileBuffer | ||
) |
Get memory profile data.
[in] | This | The EDKII_MEMORY_PROFILE_PROTOCOL instance. |
[in,out] | ProfileSize | On entry, points to the size in bytes of the ProfileBuffer. On return, points to the size of the data returned in ProfileBuffer. |
[out] | ProfileBuffer | Profile buffer. |
Definition at line 1581 of file MemoryProfileRecord.c.
EFI_STATUS EFIAPI ProfileProtocolGetRecordingState | ( | IN EDKII_MEMORY_PROFILE_PROTOCOL * | This, |
OUT BOOLEAN * | RecordingState | ||
) |
Get memory profile recording state.
[in] | This | The EDKII_MEMORY_PROFILE_PROTOCOL instance. |
[out] | RecordingState | Recording state. |
Definition at line 1706 of file MemoryProfileRecord.c.
EFI_STATUS EFIAPI ProfileProtocolRecord | ( | IN EDKII_MEMORY_PROFILE_PROTOCOL * | This, |
IN PHYSICAL_ADDRESS | CallerAddress, | ||
IN MEMORY_PROFILE_ACTION | Action, | ||
IN EFI_MEMORY_TYPE | MemoryType, | ||
IN VOID * | Buffer, | ||
IN UINTN | Size, | ||
IN CHAR8 *ActionString | OPTIONAL | ||
) |
Record memory profile of multilevel caller.
[in] | This | The EDKII_MEMORY_PROFILE_PROTOCOL instance. |
[in] | CallerAddress | Address of caller. |
[in] | Action | Memory profile action. |
[in] | MemoryType | Memory type. EfiMaxMemoryType means the MemoryType is unknown. |
[in] | Buffer | Buffer address. |
[in] | Size | Buffer size. |
[in] | ActionString | String for memory profile action. Only needed for user defined allocate action. |
Definition at line 1779 of file MemoryProfileRecord.c.
EFI_STATUS EFIAPI ProfileProtocolRegisterImage | ( | IN EDKII_MEMORY_PROFILE_PROTOCOL * | This, |
IN EFI_DEVICE_PATH_PROTOCOL * | FilePath, | ||
IN PHYSICAL_ADDRESS | ImageBase, | ||
IN UINT64 | ImageSize, | ||
IN EFI_FV_FILETYPE | FileType | ||
) |
Register image to memory profile.
[in] | This | The EDKII_MEMORY_PROFILE_PROTOCOL instance. |
[in] | FilePath | File path of the image. |
[in] | ImageBase | Image base address. |
[in] | ImageSize | Image size. |
[in] | FileType | File type of the image. |
Register image to memory profile.
[in] | This | The EDKII_MEMORY_PROFILE_PROTOCOL instance. |
[in] | FilePath | File path of the image. |
[in] | ImageBase | Image base address. |
[in] | ImageSize | Image size. |
[in] | FileType | File type of the image. |
Definition at line 1631 of file MemoryProfileRecord.c.
EFI_STATUS EFIAPI ProfileProtocolSetRecordingState | ( | IN EDKII_MEMORY_PROFILE_PROTOCOL * | This, |
IN BOOLEAN | RecordingState | ||
) |
Set memory profile recording state.
[in] | This | The EDKII_MEMORY_PROFILE_PROTOCOL instance. |
[in] | RecordingState | Recording state. |
Definition at line 1738 of file MemoryProfileRecord.c.
EFI_STATUS EFIAPI ProfileProtocolUnregisterImage | ( | IN EDKII_MEMORY_PROFILE_PROTOCOL * | This, |
IN EFI_DEVICE_PATH_PROTOCOL * | FilePath, | ||
IN PHYSICAL_ADDRESS | ImageBase, | ||
IN UINT64 | ImageSize | ||
) |
Unregister image from memory profile.
[in] | This | The EDKII_MEMORY_PROFILE_PROTOCOL instance. |
[in] | FilePath | File path of the image. |
[in] | ImageBase | Image base address. |
[in] | ImageSize | Image size. |
Definition at line 1671 of file MemoryProfileRecord.c.
BOOLEAN RegisterDxeCore | ( | IN VOID * | HobStart, |
IN MEMORY_PROFILE_CONTEXT_DATA * | ContextData | ||
) |
Register DXE Core to memory profile.
HobStart | The start address of the HOB. |
ContextData | Memory profile context. |
TRUE | Register success. |
FALSE | Register fail. |
Definition at line 530 of file MemoryProfileRecord.c.
EFI_STATUS RegisterMemoryProfileImage | ( | IN LOADED_IMAGE_PRIVATE_DATA * | DriverEntry, |
IN EFI_FV_FILETYPE | FileType | ||
) |
Register image to memory profile.
DriverEntry | Image info. |
FileType | Image file type. |
Definition at line 694 of file MemoryProfileRecord.c.
EFI_STATUS UnregisterMemoryProfileImage | ( | IN LOADED_IMAGE_PRIVATE_DATA * | DriverEntry | ) |
Unregister image from memory profile.
DriverEntry | Image info. |
Definition at line 833 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY mImageQueue = INITIALIZE_LIST_HEAD_VARIABLE (mImageQueue) |
Definition at line 38 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mMemoryProfileContext |
Definition at line 39 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA* mMemoryProfileContextPtr = NULL |
Definition at line 57 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_PROTOCOL* mMemoryProfileDriverPath |
Definition at line 62 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED UINTN mMemoryProfileDriverPathSize |
Definition at line 63 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mMemoryProfileGettingStatus = FALSE |
Definition at line 60 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED EFI_LOCK mMemoryProfileLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY) |
Definition at line 59 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mMemoryProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE |
Definition at line 61 of file MemoryProfileRecord.c.
GLOBAL_REMOVE_IF_UNREFERENCED EDKII_MEMORY_PROFILE_PROTOCOL mProfileProtocol |
Definition at line 205 of file MemoryProfileRecord.c.