Creates and initializes the DebugImageInfo Table. Also creates the configuration\r
table and registers it into the system table.\r
\r
- Note:\r
- This function allocates memory, frees it, and then allocates memory at an\r
- address within the initial allocation. Since this function is called early\r
- in DXE core initialization (before drivers are dispatched), this should not\r
- be a problem.\r
-\r
**/\r
VOID\r
CoreInitializeDebugImageInfoTable (\r
)\r
{\r
EFI_STATUS Status;\r
- EFI_PHYSICAL_ADDRESS Mem;\r
- UINTN NumberOfPages;\r
-\r
- //\r
- // Allocate boot services memory for the structure. It's required to be aligned on\r
- // a 4M boundary, so allocate a 4M block (plus what we require), free it up, calculate\r
- // a 4M aligned address within the memory we just freed, and then allocate memory at that\r
- // address for our initial structure.\r
- //\r
- NumberOfPages = FOUR_MEG_PAGES + EFI_SIZE_TO_PAGES(sizeof (EFI_SYSTEM_TABLE_POINTER));\r
\r
- Status = CoreAllocatePages (AllocateAnyPages, EfiBootServicesData, NumberOfPages , &Mem);\r
- ASSERT_EFI_ERROR (Status);\r
- if (EFI_ERROR(Status)) {\r
- return;\r
- }\r
- Status = CoreFreePages (Mem, NumberOfPages);\r
- ASSERT_EFI_ERROR (Status);\r
- if (EFI_ERROR(Status)) {\r
- return;\r
- }\r
- //\r
- // Now get a 4M aligned address within the memory range we were given.\r
- // Then allocate memory at that address\r
- //\r
- Mem = (Mem + FOUR_MEG_MASK) & (~FOUR_MEG_MASK);\r
-\r
- Status = CoreAllocatePages (AllocateAddress, EfiBootServicesData, NumberOfPages - FOUR_MEG_PAGES, &Mem);\r
- ASSERT_EFI_ERROR (Status);\r
- if (EFI_ERROR(Status)) {\r
- return;\r
- }\r
//\r
- // We now have a 4M aligned page allocated, so fill in the data structure.\r
+ // Allocate 4M aligned page for the structure and fill in the data.\r
// Ideally we would update the CRC now as well, but the service may not yet be available.\r
// See comments in the CoreUpdateDebugTableCrc32() function below for details.\r
//\r
- mDebugTable = (EFI_SYSTEM_TABLE_POINTER *)(UINTN)Mem;\r
+ mDebugTable = AllocateAlignedPages (EFI_SIZE_TO_PAGES (sizeof (EFI_SYSTEM_TABLE_POINTER)), FOUR_MEG_ALIGNMENT); \r
mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;\r
mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;\r
mDebugTable->Crc32 = 0;\r