summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c
diff options
context:
space:
mode:
authorDun Tan <dun.tan@intel.com>2023-05-15 16:10:43 +0800
committerRay Ni <ray.ni@intel.com>2023-06-30 11:07:40 +0530
commitb4dde1ae6a8a573c84a70d197a4a341f7d5bfb3d (patch)
treef2d775b6f6eca58d7db656a20070b3b93435747a /UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c
parent701b5797b260cbc9477380beb7fb071f3c5c88d1 (diff)
downloadedk2-b4dde1ae6a8a573c84a70d197a4a341f7d5bfb3d.tar.gz
edk2-b4dde1ae6a8a573c84a70d197a4a341f7d5bfb3d.tar.bz2
edk2-b4dde1ae6a8a573c84a70d197a4a341f7d5bfb3d.zip
UefiCpuPkg: Use GenSmmPageTable() to create Smm S3 page table
Use GenSmmPageTable() to create both IA32 and X64 Smm S3 page table. Signed-off-by: Dun Tan <dun.tan@intel.com> Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c')
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c
index cb7a691745..01432d466c 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c
@@ -35,26 +35,14 @@ InitSmmS3Cr3 (
VOID
)
{
- EFI_PHYSICAL_ADDRESS Pages;
- UINT64 *PTEntry;
-
- //
- // Generate PAE page table for the first 4GB memory space
- //
- Pages = Gen4GPageTable (FALSE);
-
//
- // Fill Page-Table-Level4 (PML4) entry
+ // Generate level4 page table for the first 4GB memory space
+ // Return the address of PML4 (to set CR3)
//
- PTEntry = (UINT64 *)AllocatePageTableMemory (1);
- ASSERT (PTEntry != NULL);
- *PTEntry = Pages | mAddressEncMask | PAGE_ATTRIBUTE_BITS;
- ZeroMem (PTEntry + 1, EFI_PAGE_SIZE - sizeof (*PTEntry));
-
//
- // Return the address of PML4 (to set CR3)
+ // The SmmS3Cr3 is only used by S3Resume PEIM to switch CPU from 32bit to 64bit
//
- mSmmS3ResumeState->SmmS3Cr3 = (UINT32)(UINTN)PTEntry;
+ mSmmS3ResumeState->SmmS3Cr3 = (UINT32)GenSmmPageTable (Paging4Level, 32);
return;
}