]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
UefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / PiSmmCpuDxeSmm.c
index 69a04dfb2311b65699ff51efffc643bd1ba4767d..50614f32c364b8e8e0caa3a969997ee6ff377e9b 100644 (file)
@@ -1121,6 +1121,9 @@ FindSmramInfo (
   *SmrrBase = (UINT32)CurrentSmramRange->CpuStart;\r
   *SmrrSize = (UINT32)CurrentSmramRange->PhysicalSize;\r
 \r
+  //\r
+  // Extend *SmrrBase/*SmrrSize to include adjacent SMRAM ranges\r
+  //\r
   do {\r
     Found = FALSE;\r
     for (Index = 0; Index < mSmmCpuSmramRangeCount; Index++) {\r
@@ -1432,14 +1435,20 @@ PerformRemainingTasks (
     SetMemMapAttributes ();\r
 \r
     //\r
-    // For outside SMRAM, we only map SMM communication buffer or MMIO.\r
+    // Do not protect memory outside SMRAM when SMM static page table is not enabled.\r
     //\r
-    SetUefiMemMapAttributes ();\r
+    if (mCpuSmmStaticPageTable) {\r
 \r
-    //\r
-    // Set page table itself to be read-only\r
-    //\r
-    SetPageTableAttributes ();\r
+      //\r
+      // For outside SMRAM, we only map SMM communication buffer or MMIO.\r
+      //\r
+      SetUefiMemMapAttributes ();\r
+\r
+      //\r
+      // Set page table itself to be read-only\r
+      //\r
+      SetPageTableAttributes ();\r
+    }\r
 \r
     //\r
     // Configure SMM Code Access Check feature if available.\r