]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
MdeModulePkg: Remove NORETURN for PeiCore() and DxeMain() function
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / DxeMain / DxeMain.c
index e6ed2476a4b52d55760a5481105d72e64a4edd29..21cd61ad2e147db5da58b2fddd8f85a4ed5ac56d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   DXE Core Main Entry Point\r
 \r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -207,6 +207,7 @@ EFI_SYSTEM_TABLE      *gDxeCoreST = NULL;
 EFI_RUNTIME_SERVICES  *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;\r
 EFI_HANDLE            gDxeCoreImageHandle = NULL;\r
 \r
+BOOLEAN               gMemoryMapTerminated = FALSE;\r
 \r
 //\r
 // EFI Decompress Protocol\r
@@ -247,6 +248,7 @@ DxeMain (
   EFI_HOB_GUID_TYPE             *GuidHob;\r
   EFI_VECTOR_HANDOFF_INFO       *VectorInfoList;\r
   EFI_VECTOR_HANDOFF_INFO       *VectorInfo;\r
+  VOID                          *EntryPoint;\r
 \r
   //\r
   // Setup the default exception handlers\r
@@ -289,6 +291,12 @@ DxeMain (
   Status = CoreInitializeImageServices (HobStart);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  //\r
+  // Initialize the Global Coherency Domain Services\r
+  //\r
+  Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
   //\r
   // Call constructor for all libraries\r
   //\r
@@ -300,16 +308,17 @@ DxeMain (
   // Report DXE Core image information to the PE/COFF Extra Action Library\r
   //\r
   ZeroMem (&ImageContext, sizeof (ImageContext));\r
-  ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase;\r
-  ImageContext.PdbPointer   = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress);\r
+  ImageContext.ImageAddress   = (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase;\r
+  ImageContext.PdbPointer     = PeCoffLoaderGetPdbPointer ((VOID*)(UINTN)ImageContext.ImageAddress);\r
+  ImageContext.SizeOfHeaders  = PeCoffGetSizeOfHeaders ((VOID*)(UINTN)ImageContext.ImageAddress);\r
+  Status = PeCoffLoaderGetEntryPoint ((VOID*)(UINTN)ImageContext.ImageAddress, &EntryPoint);\r
+  if (Status == EFI_SUCCESS) {\r
+    ImageContext.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;\r
+  }\r
+  ImageContext.Handle         = (VOID *)(UINTN)gDxeCoreLoadedImage->ImageBase;\r
+  ImageContext.ImageRead      = PeCoffLoaderImageReadFromMemory;\r
   PeCoffLoaderRelocateImageExtraAction (&ImageContext);\r
 \r
-  //\r
-  // Initialize the Global Coherency Domain Services\r
-  //\r
-  Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
   //\r
   // Install the DXE Services Table into the EFI System Tables's Configuration Table\r
   //\r
@@ -388,6 +397,7 @@ DxeMain (
   MemoryProfileInstallProtocol ();\r
 \r
   CoreInitializePropertiesTable ();\r
+  CoreInitializeMemoryAttributesTable ();\r
 \r
   //\r
   // Get persisted vector hand-off info from GUIDeed HOB again due to HobStart may be updated,\r
@@ -514,6 +524,8 @@ DxeMain (
   //\r
   ASSERT (FALSE);\r
   CpuDeadLoop ();\r
+\r
+  UNREACHABLE ();\r
 }\r
 \r
 \r
@@ -744,6 +756,8 @@ CoreExitBootServices (
     return Status;\r
   }\r
 \r
+  gMemoryMapTerminated = TRUE;\r
+\r
   //\r
   // Notify other drivers that we are exiting boot services.\r
   //\r