diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c index 69a04dfb23..50614f32c3 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -1121,6 +1121,9 @@ FindSmramInfo ( *SmrrBase = (UINT32)CurrentSmramRange->CpuStart; *SmrrSize = (UINT32)CurrentSmramRange->PhysicalSize; + // + // Extend *SmrrBase/*SmrrSize to include adjacent SMRAM ranges + // do { Found = FALSE; for (Index = 0; Index < mSmmCpuSmramRangeCount; Index++) { @@ -1432,14 +1435,20 @@ PerformRemainingTasks ( SetMemMapAttributes (); // - // For outside SMRAM, we only map SMM communication buffer or MMIO. + // Do not protect memory outside SMRAM when SMM static page table is not enabled. // - SetUefiMemMapAttributes (); + if (mCpuSmmStaticPageTable) { - // - // Set page table itself to be read-only - // - SetPageTableAttributes (); + // + // For outside SMRAM, we only map SMM communication buffer or MMIO. + // + SetUefiMemMapAttributes (); + + // + // Set page table itself to be read-only + // + SetPageTableAttributes (); + } // // Configure SMM Code Access Check feature if available.