RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

If IA32_ERER.NXE has already been set, skip setting it again.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Brijesh Singh <[email protected]>
Cc: Erdem Aktas <[email protected]>
Cc: James Bottomley <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Tom Lendacky <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Acked-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Min Xu <[email protected]>
---
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c 
b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
index 0700f310b203..bb426d0d0a6f 100644
--- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
+++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
@@ -179,9 +179,11 @@ EnableExecuteDisableBit (
 {
   UINT64  MsrRegisters;
 
-  MsrRegisters  = AsmReadMsr64 (0xC0000080);
-  MsrRegisters |= BIT11;
-  AsmWriteMsr64 (0xC0000080, MsrRegisters);
+  MsrRegisters = AsmReadMsr64 (0xC0000080);
+  if ((MsrRegisters & BIT11) == 0) {
+    MsrRegisters |= BIT11;
+    AsmWriteMsr64 (0xC0000080, MsrRegisters);
+  }
 }
 
 /**
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87502): https://edk2.groups.io/g/devel/message/87502
Mute This Topic: https://groups.io/mt/89725436/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to