diff options
author | Laszlo Ersek <lersek@redhat.com> | 2019-07-26 11:59:56 +0200 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2019-07-26 11:59:56 +0200 |
commit | d47b85a621add591212546b12945d7b9873fbabf (patch) | |
tree | 96c957ff4004e028e3ca609c2c559b797a54f324 /UefiCpuPkg/PiSmmCpuDxeSmm | |
parent | 30f6148546c7092650ab4886fc6d95d5065c3188 (diff) | |
download | edk2-d47b85a621add591212546b12945d7b9873fbabf.tar.gz edk2-d47b85a621add591212546b12945d7b9873fbabf.tar.bz2 edk2-d47b85a621add591212546b12945d7b9873fbabf.zip |
Revert "UefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF"
This reverts commit 30f6148546c7092650ab4886fc6d95d5065c3188.
Commit 30f6148546c7 causes a build failure, when building for IA32:
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c: In function
> 'PerformRemainingTasks':
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c:1440:9: error:
> 'mCpuSmmStaticPageTable' undeclared (first use in this function)
> if (mCpuSmmStaticPageTable) {
"mCpuSmmStaticPageTable" is an X64-only variable. It is defined in
"X64/PageTbl.c", which is not linked into the IA32 binary. We must not
reference the variable in such code that is linked into both IA32 and X64
builds, such as "PiSmmCpuDxeSmm.c".
We have encountered the same challenge at least once in the past:
- https://bugzilla.tianocore.org/show_bug.cgi?id=1593
- commit 37f9fea5b88d ("UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand
paging in SMM", 2019-04-04)
The right approach is to declare a new function in "PiSmmCpuDxeSmm.h", and
to provide two definitions for the function, one in "Ia32/PageTbl.c", and
another in "X64/PageTbl.c". The IA32 implementation should return a
constant value. The X64 implementation should return
"mCpuSmmStaticPageTable". (In the example named above, the functions were
SaveCr2() and RestoreCr2().)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: push revert immediately, due to build breakage that
would have been easy to catch before submitting the patch]
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm')
-rw-r--r-- | UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c index 50614f32c3..69a04dfb23 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -1121,9 +1121,6 @@ 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++) {
@@ -1435,20 +1432,14 @@ PerformRemainingTasks ( SetMemMapAttributes ();
//
- // Do not protect memory outside SMRAM when SMM static page table is not enabled.
+ // For outside SMRAM, we only map SMM communication buffer or MMIO.
//
- if (mCpuSmmStaticPageTable) {
-
- //
- // For outside SMRAM, we only map SMM communication buffer or MMIO.
- //
- SetUefiMemMapAttributes ();
+ SetUefiMemMapAttributes ();
- //
- // Set page table itself to be read-only
- //
- SetPageTableAttributes ();
- }
+ //
+ // Set page table itself to be read-only
+ //
+ SetPageTableAttributes ();
//
// Configure SMM Code Access Check feature if available.
|