From: "Zhiguang Liu" <zhiguang.liu@intel.com>
To: devel@edk2.groups.io
Cc: Zhiguang Liu <zhiguang.liu@intel.com>,
Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
Rahul Kumar <rahul1.kumar@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Debkumar De <debkumar.de@intel.com>,
Catharine West <catharine.west@intel.com>
Subject: [PATCH 2/2] UefiCpuPkg: Support 5 level page table in ResetVector
Date: Mon, 3 Apr 2023 17:28:14 +0800 [thread overview]
Message-ID: <20230403092814.1709-1-zhiguang.liu@intel.com> (raw)
Use a macro USE_5_LEVEL_PAGE_TABLE to determine whether to create
5 level page table. Whether creating it or not, the highest level
page table address is fixed.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: 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>
---
.../ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm | 5 ++++-
UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb | 3 +++
.../ResetVector/Vtf0/X64/PageTables5L.asm | 19 +++++++++++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 UefiCpuPkg/ResetVector/Vtf0/X64/PageTables5L.asm
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm
index 6891397c2a..b6c245e697 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm
@@ -2,7 +2,7 @@
; @file
; Transition from 32 bit flat protected mode into 64 bit flat protected mode
;
-; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;------------------------------------------------------------------------------
@@ -18,6 +18,9 @@ Transition32FlatTo64Flat:
mov eax, cr4
bts eax, 5 ; enable PAE
+%ifdef USE_5_LEVEL_PAGE_TABLE
+ bts eax, 12 ; Set LA57=1.
+%endif
mov cr4, eax
mov ecx, 0xc0000080
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
index 62887c4e8e..670d6a9053 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
+++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
@@ -46,6 +46,9 @@ StartOfPageTables:
%include "X64/PageTables2M.asm"
%endif
%endif
+%ifdef USE_5_LEVEL_PAGE_TABLE
+ %include "X64/PageTables5L.asm"
+%endif
EndOfPageTables:
%ifdef DEBUG_PORT80
diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables5L.asm b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables5L.asm
new file mode 100644
index 0000000000..e60e756422
--- /dev/null
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables5L.asm
@@ -0,0 +1,19 @@
+;------------------------------------------------------------------------------
+; @file
+; PML5 page table creation.
+;
+; Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+;------------------------------------------------------------------------------
+
+ ;
+ ; PML5 table Pointers
+ ; Assume page table is create from bottom to top, and only one PML4 table there.
+ ;
+ DQ (ADDR_OF($) - 0x1000 + PAGE_PDP_ATTR)
+
+ ;
+ ; Only first PML5 entry(first 8 bytes) pointting to a PML4 table. Others are zero
+ ;
+ TIMES (0x1000 - 0x8) DB 0
--
2.31.1.windows.1
next reply other threads:[~2023-04-03 9:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 9:28 Zhiguang Liu [this message]
2023-04-03 11:55 ` [PATCH 2/2] UefiCpuPkg: Support 5 level page table in ResetVector Gerd Hoffmann
2023-04-14 7:09 ` [edk2-devel] " Zhiguang Liu
2023-04-14 10:04 ` Gerd Hoffmann
2023-04-15 5:02 ` Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230403092814.1709-1-zhiguang.liu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox