]> git.proxmox.com Git - mirror_edk2.git/commit
Revert "UefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF"
authorLaszlo Ersek <lersek@redhat.com>
Fri, 26 Jul 2019 09:59:56 +0000 (11:59 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 26 Jul 2019 09:59:56 +0000 (11:59 +0200)
commitd47b85a621add591212546b12945d7b9873fbabf
tree96c957ff4004e028e3ca609c2c559b797a54f324
parent30f6148546c7092650ab4886fc6d95d5065c3188
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]
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c