]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Core/DxeIplX64Peim/DxeLoadX64.c
Use global variable gInMemory in place of gInMemoryGuid ppi in DxeIplX64 module to...
[mirror_edk2.git] / EdkModulePkg / Core / DxeIplX64Peim / DxeLoadX64.c
index 655d89045d856a84836e2a2d6cb9dd7d68ef3423..57ffb28f4ae00ea2b8f5cbe1fb1540237e369e62 100644 (file)
@@ -22,7 +22,9 @@ Abstract:
 \r
 #include <DxeIpl.h>\r
 \r
+#ifndef __GNUC__\r
 #pragma warning( disable : 4305 )\r
+#endif\r
 \r
 BOOLEAN gInMemory = FALSE;\r
 \r
@@ -50,12 +52,6 @@ static EFI_PEI_PPI_DESCRIPTOR     mPpiList = {
   &mDxeIplPpi\r
 };\r
 \r
-static EFI_PEI_PPI_DESCRIPTOR     mPpiPeiInMemory = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gPeiInMemoryGuid,\r
-  NULL\r
-};\r
-\r
 static EFI_PEI_PPI_DESCRIPTOR     mPpiSignal = {\r
   (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
   &gEfiEndOfPeiSignalPpiGuid,\r
@@ -125,14 +121,7 @@ Returns:
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  Status = PeiServicesLocatePpi (\r
-             &gPeiInMemoryGuid,\r
-             0,\r
-             NULL,\r
-             NULL\r
-             );\r
-\r
-  if (EFI_ERROR (Status) && (BootMode != BOOT_ON_S3_RESUME)) {   \r
+  if (!gInMemory && (BootMode != BOOT_ON_S3_RESUME)) {   \r
     //\r
     // The DxeIpl has not yet been shadowed\r
     //\r
@@ -148,10 +137,6 @@ Returns:
 \r
   } else {\r
     if (BootMode != BOOT_ON_S3_RESUME) {\r
-    //\r
-    // The DxeIpl has been shadowed\r
-    //\r
-    gInMemory = TRUE;\r
 \r
     //\r
     // Install LoadFile PPI\r
@@ -165,7 +150,7 @@ Returns:
     //\r
     // Install DxeIpl PPI\r
     //\r
-    PeiServicesInstallPpi (&mPpiList);\r
+    Status = PeiServicesInstallPpi (&mPpiList);\r
 \r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
@@ -272,7 +257,7 @@ Returns:
   //\r
   //  X64 Calling Conventions requires that the stack must be aligned to 16 bytes\r
   //\r
-  TopOfStack = ALIGN_POINTER (TopOfStack, 16);\r
+  TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, 16);\r
 \r
   //\r
   // Add architecture-specifc HOBs (including the BspStore HOB)\r
@@ -324,8 +309,9 @@ Returns:
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
-  // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA \\r
+  // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA\r
   // memory, it may be corrupted when copying FV to high-end memory \r
+  //\r
   LoadGo64Gdt();\r
 \r
   //\r
@@ -617,14 +603,9 @@ Returns:
  \r
   if (Status == EFI_SUCCESS) {\r
     //\r
-    // Install PeiInMemory to indicate the Dxeipl is shadowed\r
+    // Set gInMemory global variable to TRUE to indicate the dxeipl is shadowed.\r
     //\r
-    Status = PeiServicesInstallPpi (&mPpiPeiInMemory);\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-\r
+    *(BOOLEAN *) ((UINTN) &gInMemory + (UINTN) DxeIplEntryPoint - (UINTN) _ModuleEntryPoint) = TRUE;\r
     Status = ((EFI_PEIM_ENTRY_POINT) (UINTN) DxeIplEntryPoint) (DxeIplFileHeader, GetPeiServicesTablePointer());\r
   }\r
 \r
@@ -1061,4 +1042,5 @@ Returns:
   *Pe32Data = SectionData;\r
 \r
   return EFI_SUCCESS;\r
-}
\ No newline at end of file
+}\r
+\r