]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
MdeModulePkg/PeiCore: Enable T-RAM evacuation in PeiCore (CVE-2019-11098)
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain / PeiMain.c
index cca57c4c068643c97e7c027a10ca3fdbef9b19c5..2ad08878d97e9295125095aa125d5a49fc3f0d5c 100644 (file)
@@ -319,8 +319,9 @@ PeiCore (
       // PEI Core and PEIMs to get high performance.\r
       //\r
       OldCoreData->ShadowedPeiCore = (PEICORE_FUNCTION_POINTER) (UINTN) PeiCore;\r
-      if ((HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnS3Boot))\r
-          || (HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnBoot))) {\r
+      if (PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes) ||\r
+          (HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnS3Boot)) ||\r
+          (HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnBoot))) {\r
         OldCoreData->ShadowedPeiCore = ShadowPeiCore (OldCoreData);\r
       }\r
 \r
@@ -418,6 +419,23 @@ PeiCore (
       ProcessPpiListFromSec ((CONST EFI_PEI_SERVICES **) &PrivateData.Ps, PpiList);\r
     }\r
   } else {\r
+    if (PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes)) {\r
+      //\r
+      // When PcdMigrateTemporaryRamFirmwareVolumes is TRUE, alway shadow all\r
+      // PEIMs no matter the condition of PcdShadowPeimOnBoot and PcdShadowPeimOnS3Boot\r
+      //\r
+      DEBUG ((DEBUG_VERBOSE, "PPI lists before temporary RAM evacuation:\n"));\r
+      DumpPpiList (&PrivateData);\r
+\r
+      //\r
+      // Migrate installed content from Temporary RAM to Permanent RAM\r
+      //\r
+      EvacuateTempRam (&PrivateData, SecCoreData);\r
+\r
+      DEBUG ((DEBUG_VERBOSE, "PPI lists after temporary RAM evacuation:\n"));\r
+      DumpPpiList (&PrivateData);\r
+    }\r
+\r
     //\r
     // Try to locate Temporary RAM Done Ppi.\r
     //\r