]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/Memory/MemoryServices.c
Fix the issue that accessing for unaligned address break IPF
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Memory / MemoryServices.c
index 22e04cd46abcfba014978a49c7e471b094ae6861..6314f759990da0212da88390a3eab410f7c0cf69 100644 (file)
@@ -89,6 +89,17 @@ PeiInstallPeiMemory (
   DEBUG ((EFI_D_INFO, "PeiInstallPeiMemory MemoryBegin 0x%LX, MemoryLength 0x%LX\n", MemoryBegin, MemoryLength));\r
   PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);\r
 \r
+  //\r
+  // PEI_SERVICE.InstallPeiMemory should only be called one time during whole PEI phase.\r
+  // If it is invoked more than one time, ASSERT information is given for developer debugging in debug tip and\r
+  // simply return EFI_SUCESS in release tip to ignore it.\r
+  // \r
+  if (PrivateData->PeiMemoryInstalled) {\r
+    DEBUG ((EFI_D_ERROR, "ERROR: PeiInstallPeiMemory is called more than once!\n"));\r
+    ASSERT (PrivateData->PeiMemoryInstalled);\r
+    return EFI_SUCCESS;\r
+  }\r
+  \r
   PrivateData->PhysicalMemoryBegin   = MemoryBegin;\r
   PrivateData->PhysicalMemoryLength  = MemoryLength;\r
   PrivateData->FreePhysicalMemoryTop = MemoryBegin + MemoryLength;\r
@@ -138,7 +149,7 @@ PeiAllocatePages (
   //\r
   if (!PrivateData->PeiMemoryInstalled) {\r
     //\r
-    // When PeiInstallMemory is called but CAR has *not* been moved to temporary memory,\r
+    // When PeiInstallMemory is called but temporary memory has *not* been moved to temporary memory,\r
     // the AllocatePage will depend on the field of PEI_CORE_INSTANCE structure.\r
     //\r
     if (!PrivateData->SwitchStackSignal) {\r
@@ -196,7 +207,7 @@ PeiAllocatePages (
 /**\r
 \r
   Pool allocation service. Before permenent memory is discoveried, the pool will \r
-  be allocated the heap in the CAR. Genenrally, the size of heap in temporary \r
+  be allocated the heap in the temporary memory. Genenrally, the size of heap in temporary \r
   memory does not exceed to 64K, so the biggest pool size could be allocated is \r
   64K.\r
 \r