audk/UefiCpuPkg/PiSmmCpuDxeSmm
Sheng Wei 404250c8f7 UefiCpuPkg/PiSmmCpuDxeSmm: Reflect page table depth with page table address
When trying to get page table base, if mInternalCr3 is zero, it will use
 the page table from CR3, and reflect the page table depth by CR4 LA57 bit.
If mInternalCr3 is non zero, it will use the page table from mInternalCr3
 and reflect the page table depth of mInternalCr3 at same time.
In the case of X64, we use m5LevelPagingNeeded to reflect the depth of
 the page table. And in the case of IA32, it will not the page table depth
 information.

This patch is a bug fix when enable CET feature with 5 level paging.
The SMM page tables are allocated / initialized in PiCpuSmmEntry().
When CET is enabled, PiCpuSmmEntry() must further modify the attribute of
 shadow stack pages. This page table is not set to CR3 in PiCpuSmmEntry().
 So the page table base address is set to mInternalCr3 for modifty the
 page table attribute. It could not use CR4 LA57 bit to reflect the
 page table depth for mInternalCr3.
So we create a architecture-specific implementation GetPageTable() with
 2 output parameters. One parameter is used to output the page table
 address. Another parameter is used to reflect if it is 5 level paging
 or not.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3015

Signed-off-by: Sheng Wei <w.sheng@intel.com>
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>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
2020-11-18 04:52:26 +00:00
..
Ia32 UefiCpuPkg/PiSmmCpuDxeSmm: Reflect page table depth with page table address 2020-11-18 04:52:26 +00:00
X64 UefiCpuPkg/PiSmmCpuDxeSmm: Reflect page table depth with page table address 2020-11-18 04:52:26 +00:00
CpuS3.c UefiCpuPkg/PiSmmCpuDxeSmm: fix S3 Resume for CPU hotplug 2020-03-04 12:22:07 +00:00
CpuService.c UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
CpuService.h UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
MpService.c UefiCpuPkg/PiSmmCpuDxeSmm: pause in WaitForSemaphore() before re-fetch 2020-07-31 13:27:50 +00:00
PiSmmCpuDxeSmm.c UefiCpuPkg/PiSmm: Fix various typos 2020-02-10 22:30:07 +00:00
PiSmmCpuDxeSmm.h UefiCpuPkg/PiSmmCpuDxeSmm: Reflect page table depth with page table address 2020-11-18 04:52:26 +00:00
PiSmmCpuDxeSmm.inf UefiCpuPkg/PiSmmCpuDxeSmm: Avoid allocate Token every time 2019-12-06 06:41:16 +00:00
PiSmmCpuDxeSmm.uni UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
PiSmmCpuDxeSmmExtra.uni UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
SmmCpuMemoryManagement.c UefiCpuPkg/PiSmmCpuDxeSmm: Reflect page table depth with page table address 2020-11-18 04:52:26 +00:00
SmmMp.c UefiCpuPkg/PiSmmCpuDxeSmm: Enable MM MP Protocol 2019-07-16 11:54:55 +08:00
SmmMp.h UefiCpuPkg/PiSmmCpuDxeSmm: Keep function comment and declaration adjacent 2019-08-02 14:19:13 +08:00
SmmProfile.c UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on AMD 2020-07-07 23:25:16 +00:00
SmmProfile.h UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
SmmProfileInternal.h UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on AMD 2020-07-07 23:25:16 +00:00
SmramSaveState.c UefiCpuPkg/PiSmm: Fix various typos 2020-02-10 22:30:07 +00:00
SyncTimer.c UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00