From 74a88770337121b046ec5f055d4ae06abc37fa60 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Wed, 20 Apr 2016 17:27:40 +0800 Subject: MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation Current MemoryAttributesTable will be installed on ReadyToBoot event at TPL_NOTIFY level, it maybe incorrect when PcdHiiOsRuntimeSupport = TRUE as HiiDatabaseDxe will have runtime memory allocation for HII OS runtime support on and after ReadyToBoot. The issue was exposed at http://article.gmane.org/gmane.comp.bios.edk2.devel/10125. To make sure the correctness of MemoryAttributesTable, this patch is to enhance MemoryAttributesTable installation to install MemoryAttributesTable on ReadyToBoot event at TPL_CALLBACK - 1 level to make sure it is at the last of ReadyToBoot event, and also hook runtime memory allocation after ReadyToBoot. Cc: Jiewen Yao Cc: Liming Gao Cc: Feng Tian Cc: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c') diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index a458d6b64f..70a283bc2b 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -207,6 +207,7 @@ EFI_SYSTEM_TABLE *gDxeCoreST = NULL; EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate; EFI_HANDLE gDxeCoreImageHandle = NULL; +BOOLEAN gMemoryMapTerminated = FALSE; // // EFI Decompress Protocol @@ -751,6 +752,8 @@ CoreExitBootServices ( return Status; } + gMemoryMapTerminated = TRUE; + // // Notify other drivers that we are exiting boot services. // -- cgit v1.2.3