From 803ed060ee2b22cc136ae97308d494a9d6716947 Mon Sep 17 00:00:00 2001 From: Dun Tan Date: Wed, 10 Aug 2022 11:31:57 +0800 Subject: 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 Reviewed-by: Guo Dong Cc: Maurice Ma Cc: Benjamin You Cc: Sean Rhodes Reviewed-by: Ray Ni --- UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'UefiPayloadPkg/UefiPayloadEntry') 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. // -- cgit v1.2.3