summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDun Tan <dun.tan@intel.com>2022-08-10 11:31:57 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-08-15 05:15:43 +0000
commit803ed060ee2b22cc136ae97308d494a9d6716947 (patch)
tree861e9a6af7de0c2583df91e054647f037c39fd80
parent62391b4ce962095018bffed55422ae4ba6ef94d6 (diff)
downloadedk2-803ed060ee2b22cc136ae97308d494a9d6716947.tar.gz
edk2-803ed060ee2b22cc136ae97308d494a9d6716947.tar.bz2
edk2-803ed060ee2b22cc136ae97308d494a9d6716947.zip
UefiPayloadPkg: Remove clearing CR0.WP when protecting pagetable
Remove clearing CR0.WP when marking the memory used for page table as read-only in the page table itself created by UefiPayloadEntry. This page table address is written to Cr3 after these protection steps. Till this, the memory used for page table is always RW. Signed-off-by: Dun Tan <dun.tan@intel.com> Reviewed-by: Guo Dong <guo.dong@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Reviewed-by: Ray Ni <ray.ni@intel.com>
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
index 74b667a62a..a586941352 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
@@ -622,12 +622,7 @@ EnablePageTableProtection (
}
//
- // Disable write protection, because we need to mark page table to be write
- // protected.
- //
- AsmWriteCr0 (AsmReadCr0 () & ~CR0_WP);
-
- //
+ // No need to clear CR0.WP since PageTableBase has't been written to CR3 yet.
// SetPageTablePoolReadOnly might update mPageTablePool. It's safer to
// remember original one in advance.
//