diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2024-03-01 08:43:54 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-03-01 18:47:27 +0000 |
commit | 52e44713d23de600ac7eb12bdfa0600abd2294eb (patch) | |
tree | 9bc03239af104b177e7c424dde00df72ddf8d10b /OvmfPkg/ResetVector | |
parent | fded08e74400fd0b76ad4733111e946f3ecea244 (diff) | |
download | edk2-52e44713d23de600ac7eb12bdfa0600abd2294eb.tar.gz edk2-52e44713d23de600ac7eb12bdfa0600abd2294eb.tar.bz2 edk2-52e44713d23de600ac7eb12bdfa0600abd2294eb.zip |
OvmfPkg/ResetVector: add ClearOvmfPageTables macro
Move code to clear the page tables to a nasm macro.
No functional change.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20240301074402.98625-3-kraxel@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Oliver Steffen <osteffen@redhat.com>
Cc: Michael Roth <michael.roth@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
[lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list
posting into "Cc:" tags in the commit message, in order to pacify
"PatchCheck.py"]
Diffstat (limited to 'OvmfPkg/ResetVector')
-rw-r--r-- | OvmfPkg/ResetVector/Ia32/PageTables64.asm | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm b/OvmfPkg/ResetVector/Ia32/PageTables64.asm index 6fec6f2bee..378ba2feeb 100644 --- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm +++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm @@ -46,6 +46,24 @@ BITS 32 %define TDX_AP 2
;
+; For OVMF, build some initial page tables at
+; PcdOvmfSecPageTablesBase - (PcdOvmfSecPageTablesBase + 0x6000).
+;
+; This range should match with PcdOvmfSecPageTablesSize which is
+; declared in the FDF files.
+;
+; At the end of PEI, the pages tables will be rebuilt into a
+; more permanent location by DxeIpl.
+;
+%macro ClearOvmfPageTables 0
+ mov ecx, 6 * 0x1000 / 4
+ xor eax, eax
+.clearPageTablesMemoryLoop:
+ mov dword[ecx * 4 + PT_ADDR (0) - 4], eax
+ loop .clearPageTablesMemoryLoop
+%endmacro
+
+;
; Modified: EAX, EBX, ECX, EDX
;
SetCr3ForPageTables64:
@@ -69,22 +87,7 @@ SetCr3ForPageTables64: OneTimeCall GetSevCBitMaskAbove31
ClearOvmfPageTables:
- ;
- ; For OVMF, build some initial page tables at
- ; PcdOvmfSecPageTablesBase - (PcdOvmfSecPageTablesBase + 0x6000).
- ;
- ; This range should match with PcdOvmfSecPageTablesSize which is
- ; declared in the FDF files.
- ;
- ; At the end of PEI, the pages tables will be rebuilt into a
- ; more permanent location by DxeIpl.
- ;
-
- mov ecx, 6 * 0x1000 / 4
- xor eax, eax
-clearPageTablesMemoryLoop:
- mov dword[ecx * 4 + PT_ADDR (0) - 4], eax
- loop clearPageTablesMemoryLoop
+ ClearOvmfPageTables
;
; Top level Page Directory Pointers (1 * 512GB entry)
|