mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/Core/Dxe: Initialize GCD before RT memory allocations
Update the DxeMain initialization order to initialize GCD services before any runtime allocations are performed. This is required to prevent runtime data fragmentation when the UEFI System Table and UEFI Runtime Service Table are allocated before both the memory and GCD services are initialized. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Aaron Li <aaron.li@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
909a9a5ae4
commit
c5e702e45a
|
@ -276,6 +276,18 @@ DxeMain (
|
|||
|
||||
MemoryProfileInit (HobStart);
|
||||
|
||||
//
|
||||
// Start the Image Services.
|
||||
//
|
||||
Status = CoreInitializeImageServices (HobStart);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Initialize the Global Coherency Domain Services
|
||||
//
|
||||
Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
|
||||
// Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
|
||||
|
@ -289,16 +301,9 @@ DxeMain (
|
|||
gDxeCoreST->RuntimeServices = gDxeCoreRT;
|
||||
|
||||
//
|
||||
// Start the Image Services.
|
||||
// Update DXE Core Loaded Image Protocol with allocated UEFI System Table
|
||||
//
|
||||
Status = CoreInitializeImageServices (HobStart);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Initialize the Global Coherency Domain Services
|
||||
//
|
||||
Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
gDxeCoreLoadedImage->SystemTable = gDxeCoreST;
|
||||
|
||||
//
|
||||
// Call constructor for all libraries
|
||||
|
|
|
@ -218,13 +218,12 @@ CoreInitializeImageServices (
|
|||
//
|
||||
Image = &mCorePrivateImage;
|
||||
|
||||
Image->EntryPoint = (EFI_IMAGE_ENTRY_POINT)(UINTN)DxeCoreEntryPoint;
|
||||
Image->ImageBasePage = DxeCoreImageBaseAddress;
|
||||
Image->NumberOfPages = (UINTN)(EFI_SIZE_TO_PAGES ((UINTN)(DxeCoreImageLength)));
|
||||
Image->Tpl = gEfiCurrentTpl;
|
||||
Image->Info.SystemTable = gDxeCoreST;
|
||||
Image->Info.ImageBase = (VOID *)(UINTN)DxeCoreImageBaseAddress;
|
||||
Image->Info.ImageSize = DxeCoreImageLength;
|
||||
Image->EntryPoint = (EFI_IMAGE_ENTRY_POINT)(UINTN)DxeCoreEntryPoint;
|
||||
Image->ImageBasePage = DxeCoreImageBaseAddress;
|
||||
Image->NumberOfPages = (UINTN)(EFI_SIZE_TO_PAGES ((UINTN)(DxeCoreImageLength)));
|
||||
Image->Tpl = gEfiCurrentTpl;
|
||||
Image->Info.ImageBase = (VOID *)(UINTN)DxeCoreImageBaseAddress;
|
||||
Image->Info.ImageSize = DxeCoreImageLength;
|
||||
|
||||
//
|
||||
// Install the protocol interfaces for this image
|
||||
|
|
Loading…
Reference in New Issue