UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmiCr3" with PatchInstructionX86()
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / SmramSaveState.c
index f0c289254330d3949a0f00dcd3fcc98818c13b9f..5c2eb9ab6a1e28c1e56b60940eca492883ef9b64 100644 (file)
@@ -107,7 +107,7 @@ typedef struct {
 ///\r
 X86_ASSEMBLY_PATCH_LABEL gPatchSmbase;\r
 X86_ASSEMBLY_PATCH_LABEL gPatchSmiStack;\r
 ///\r
 X86_ASSEMBLY_PATCH_LABEL gPatchSmbase;\r
 X86_ASSEMBLY_PATCH_LABEL gPatchSmiStack;\r
-extern UINT32            gSmiCr3;\r
+X86_ASSEMBLY_PATCH_LABEL gPatchSmiCr3;\r
 extern volatile UINT8    gcSmiHandlerTemplate[];\r
 extern CONST UINT16      gcSmiHandlerSize;\r
 \r
 extern volatile UINT8    gcSmiHandlerTemplate[];\r
 extern CONST UINT16      gcSmiHandlerSize;\r
 \r
@@ -719,7 +719,7 @@ InstallSmiHandler (
   //\r
   CpuSmiStack = (UINT32)((UINTN)SmiStack + StackSize - sizeof (UINTN));\r
   PatchInstructionX86 (gPatchSmiStack, CpuSmiStack, 4);\r
   //\r
   CpuSmiStack = (UINT32)((UINTN)SmiStack + StackSize - sizeof (UINTN));\r
   PatchInstructionX86 (gPatchSmiStack, CpuSmiStack, 4);\r
-  gSmiCr3               = Cr3;\r
+  PatchInstructionX86 (gPatchSmiCr3, Cr3, 4);\r
   PatchInstructionX86 (gPatchSmbase, SmBase, 4);\r
   gSmiHandlerIdtr.Base  = IdtBase;\r
   gSmiHandlerIdtr.Limit = (UINT16)(IdtSize - 1);\r
   PatchInstructionX86 (gPatchSmbase, SmBase, 4);\r
   gSmiHandlerIdtr.Base  = IdtBase;\r
   gSmiHandlerIdtr.Limit = (UINT16)(IdtSize - 1);\r