If mInternalCr3 is non zero, it will use the page table from mInternalCr3.
And it will use mInternalIs5LevelPaging to reflect the page table type.
If use page table from CR3, reflect the page table type by CR4 LA57 bit.
It is a fix for enable CET feature with 5 level paging.
PiCpuSmmEntry() will generate the page table of SMM shack memory.
If CET feature is enabled, it also includes the SMM shadows shack memory.
And we need to set some attributes on SMM shadows shack memory
in PiCpuSmmEntry() when CET feature is enabled.
Since the page table of SMM shack memory is used in SMI entry, and it does not
set to CR3 in PiCpuSmmEntry(). We use mInternalCr3 as page table root
when PiCpuSmmEntry() calls ConvertMemoryPageAttributes(). We need to use
mInternalIs5LevelPaging determining whether 5-level paging is enabled or not.
If mInternalCr3 is zero, ConvertMemoryPageAttributes() will use the page table
in CR3, and refects the page table type by CR4 LA57 bit.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3015
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Sheng Wei (2):
UefiCpuPkg/PiSmmCpuDxeSmm: Correct the Cr3 typo
UefiCpuPkg/PiSmmCpuDxeSmm: Return level paging type for Internal CR3
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 10 ++++
UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 53 ++++++++++++++++++----
UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 2 +
3 files changed, 57 insertions(+), 8 deletions(-)
--
2.16.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66904): https://edk2.groups.io/g/devel/message/66904
Mute This Topic: https://groups.io/mt/78000108/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-