18UINTN mMaxTableEntries = 0;
22#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
48 AlignmentMask = SIZE_4MB - 1;
56 Memory =
PcdGet64 (PcdMaxEfiSystemTablePointerAddress);
67 if (EFI_ERROR (Status)) {
68 if (
PcdGet64 (PcdMaxEfiSystemTablePointerAddress) != 0) {
69 DEBUG ((DEBUG_INFO,
"Allocate memory for EFI_SYSTEM_TABLE_POINTER below PcdMaxEfiSystemTablePointerAddress failed. \
70 Retry to allocate memroy as close to the top of memory as feasible.\n"));
84 if (EFI_ERROR (Status)) {
92 AlignedMemory = ((
UINTN)Memory + AlignmentMask) & ~AlignmentMask;
94 if (UnalignedPages > 0) {
103 UnalignedPages = RealPages - Pages - UnalignedPages;
104 if (UnalignedPages > 0) {
116 ASSERT (mDebugTable !=
NULL);
121 mDebugTable->
Signature = EFI_SYSTEM_TABLE_SIGNATURE;
123 mDebugTable->
Crc32 = 0;
146 ASSERT (mDebugTable !=
NULL);
147 mDebugTable->
Crc32 = 0;
163 IN UINT32 ImageInfoType,
176 mDebugInfoTableHeader.
UpdateStatus |= EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
180 if (mDebugInfoTableHeader.
TableSize < mMaxTableEntries) {
185 while (Table[Index].NormalImage !=
NULL) {
192 ASSERT (Index < mMaxTableEntries);
197 TableSize = mMaxTableEntries * EFI_DEBUG_TABLE_ENTRY_SIZE;
199 if (NewTable ==
NULL) {
200 mDebugInfoTableHeader.
UpdateStatus &= ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
207 CopyMem (NewTable, Table, TableSize);
221 Index = mMaxTableEntries;
222 mMaxTableEntries += EFI_PAGE_SIZE / EFI_DEBUG_TABLE_ENTRY_SIZE;
229 if (Table[Index].NormalImage !=
NULL) {
233 Table[Index].NormalImage->
ImageInfoType = (UINT32)ImageInfoType;
235 Table[Index].NormalImage->
ImageHandle = ImageHandle;
240 mDebugInfoTableHeader.
UpdateStatus |= EFI_DEBUG_IMAGE_INFO_TABLE_MODIFIED;
243 mDebugInfoTableHeader.
UpdateStatus &= ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
260 mDebugInfoTableHeader.
UpdateStatus |= EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
264 for (Index = 0; Index < mMaxTableEntries; Index++) {
265 if ((Table[Index].NormalImage !=
NULL) && (Table[Index].NormalImage->ImageHandle == ImageHandle)) {
271 Table[Index].NormalImage =
NULL;
276 mDebugInfoTableHeader.
UpdateStatus |= EFI_DEBUG_IMAGE_INFO_TABLE_MODIFIED;
281 mDebugInfoTableHeader.
UpdateStatus &= ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID CoreNewDebugImageInfoEntry(IN UINT32 ImageInfoType, IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, IN EFI_HANDLE ImageHandle)
VOID CoreInitializeDebugImageInfoTable(VOID)
VOID CoreUpdateDebugTableCrc32(VOID)
VOID CoreRemoveDebugImageInfoEntry(EFI_HANDLE ImageHandle)
EFI_STATUS EFIAPI CoreAllocatePages(IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN NumberOfPages, IN OUT EFI_PHYSICAL_ADDRESS *Memory)
EFI_STATUS EFIAPI CoreInstallConfigurationTable(IN EFI_GUID *Guid, IN VOID *Table)
EFI_STATUS EFIAPI CoreFreePages(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
EFI_STATUS EFIAPI CoreFreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define PcdGet64(TokenName)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_PAGES_TO_SIZE(Pages)
#define EFI_SIZE_TO_PAGES(Size)
EFI_LOADED_IMAGE_PROTOCOL * LoadedImageProtocolInstance
volatile UINT32 UpdateStatus
EFI_DEBUG_IMAGE_INFO * EfiDebugImageInfoTable
UINT32 Crc32
A 32-bit CRC value that is used to verify the EFI_SYSTEM_TABLE_POINTER structure is valid.
UINT64 Signature
A constant UINT64 that has the value EFI_SYSTEM_TABLE_SIGNATURE.
EFI_PHYSICAL_ADDRESS EfiSystemTableBase
The physical address of the EFI system table.