]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/DxeIpl: Remove clearing CR0.WP when protecting pagetable
authorDun Tan <dun.tan@intel.com>
Tue, 26 Jul 2022 14:13:40 +0000 (22:13 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 15 Aug 2022 05:15:43 +0000 (05:15 +0000)
Remove clearing CR0.WP when marking the memory used for page table
as read-only in the page table itself created by DxeIpl. 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>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Ray Ni <ray.ni@intel.com>
MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c

index a451ca160408747683199def0752fb29ff721a30..18b121d7688c5ddc2515f785dd14335814f132a6 100644 (file)
@@ -626,12 +626,7 @@ EnablePageTableProtection (
   }\r
 \r
   //\r
-  // Disable write protection, because we need to mark page table to be write\r
-  // protected.\r
-  //\r
-  AsmWriteCr0 (AsmReadCr0 () & ~CR0_WP);\r
-\r
-  //\r
+  // No need to clear CR0.WP since PageTableBase has't been written to CR3 yet.\r
   // SetPageTablePoolReadOnly might update mPageTablePool. It's safer to\r
   // remember original one in advance.\r
   //\r