summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
diff options
context:
space:
mode:
authorLiu, Zhiguang <Zhiguang.Liu@intel.com>2023-05-08 16:15:01 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-05-30 05:55:44 +0000
commitc19e3f578f51f9ce6645a319c83b7476c081fcbb (patch)
tree558da93b09811b9d4e20ebf2fcc7d2ab2246b2cb /UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
parentcc62b85a4ac61c553a3ff1a1e68b8fe3d8515476 (diff)
downloadedk2-c19e3f578f51f9ce6645a319c83b7476c081fcbb.tar.gz
edk2-c19e3f578f51f9ce6645a319c83b7476c081fcbb.tar.bz2
edk2-c19e3f578f51f9ce6645a319c83b7476c081fcbb.zip
UefiCpuPkg/ResetVector: Simplify page table creation in ResetVector
Currently, page table creation has many hard-code values about the offset to the start of page table. To simplify it, add Labels such as Pml4, Pdp and Pd, so that we can remove many hard-code values Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Cc: Debkumar De <debkumar.de@intel.com> Cc: Catharine West <catharine.west@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Diffstat (limited to 'UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm')
-rw-r--r--UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm34
1 files changed, 15 insertions, 19 deletions
diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
index 1221b023fe..731dabad4d 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
@@ -28,36 +28,32 @@ BITS 64
PAGE_READ_WRITE + \
PAGE_PRESENT)
-%define PGTBLS_OFFSET(x) ((x) - TopLevelPageDirectory)
-%define PGTBLS_ADDR(x) (ADDR_OF(TopLevelPageDirectory) + (x))
-
-%define PAGE_NLE(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \
+%define PAGE_NLE(address) (ADDR_OF(address) + \
PAGE_NLE_ATTR)
%define PAGE_PDE_2MB(x) ((x << 21) + PAGE_BLE_ATTR)
-TopLevelPageDirectory:
-
+Pml4:
;
- ; Top level Page Directory Pointers (1 * 512GB entry)
+ ; PML4 (1 * 512GB entry)
;
- DQ PAGE_NLE(0x1000)
-
+ DQ PAGE_NLE(Pdp)
+ TIMES 0x1000 - ($ - Pml4) DB 0
+Pdp:
;
- ; Next level Page Directory Pointers (4 * 1GB entries => 4GB)
+ ; Page-directory pointer table (4 * 1GB entries => 4GB)
;
- TIMES 0x1000-PGTBLS_OFFSET($) DB 0
-
- DQ PAGE_NLE(0x2000)
- DQ PAGE_NLE(0x3000)
- DQ PAGE_NLE(0x4000)
- DQ PAGE_NLE(0x5000)
+ DQ PAGE_NLE(Pd)
+ DQ PAGE_NLE(Pd + 0x1000)
+ DQ PAGE_NLE(Pd + 0x2000)
+ DQ PAGE_NLE(Pd + 0x3000)
+ TIMES 0x1000 - ($ - Pdp) DB 0
+Pd:
;
- ; Page Table Entries (2048 * 2MB entries => 4GB)
+ ; Page-Directory (2048 * 2MB entries => 4GB)
+ ; Four pages below, each is pointed by one entry in Pdp.
;
- TIMES 0x2000-PGTBLS_OFFSET($) DB 0
-
%assign i 0
%rep 0x800
DQ PAGE_PDE_2MB(i)