\r
SmmS3ResumeState->SmmS3Cr0 = gSmmCr0;\r
SmmS3ResumeState->SmmS3Cr3 = Cr3;\r
- SmmS3ResumeState->SmmS3Cr4 = gSmmCr4;\r
+ SmmS3ResumeState->SmmS3Cr4 = mSmmCr4;\r
\r
if (sizeof (UINTN) == sizeof (UINT64)) {\r
SmmS3ResumeState->Signature = SMM_S3_RESUME_SMM_64;\r
extern ASM_PFX(mSmmRelocationOriginalAddress)\r
\r
global ASM_PFX(gPatchSmmCr3)\r
-global ASM_PFX(gSmmCr4)\r
+global ASM_PFX(gPatchSmmCr4)\r
global ASM_PFX(gSmmCr0)\r
global ASM_PFX(gSmmJmpAddr)\r
global ASM_PFX(gSmmInitStack)\r
ASM_PFX(gPatchSmmCr3):\r
mov cr3, eax\r
o32 lgdt [cs:ebp + (ASM_PFX(gcSmiInitGdtr) - ASM_PFX(SmmStartup))]\r
- DB 0x66, 0xb8 ; mov eax, imm32\r
-ASM_PFX(gSmmCr4): DD 0\r
+ mov eax, strict dword 0 ; source operand will be patched\r
+ASM_PFX(gPatchSmmCr4):\r
mov cr4, eax\r
mov ecx, 0xc0000080 ; IA32_EFER MSR\r
rdmsr\r
\r
UINT8 mPhysicalAddressBits;\r
\r
+//\r
+// Control register contents saved for SMM S3 resume state initialization.\r
+//\r
+UINT32 mSmmCr4;\r
+\r
/**\r
Initialize IDT to setup exception handlers for SMM.\r
\r
//\r
gSmmCr0 = (UINT32)AsmReadCr0 ();\r
PatchInstructionX86 (gPatchSmmCr3, AsmReadCr3 (), 4);\r
- gSmmCr4 = (UINT32)AsmReadCr4 ();\r
+ mSmmCr4 = (UINT32)AsmReadCr4 ();\r
+ PatchInstructionX86 (gPatchSmmCr4, mSmmCr4, 4);\r
\r
//\r
// Patch GDTR for SMM base relocation\r
extern CONST UINT16 gcSmmInitSize;\r
extern UINT32 gSmmCr0;\r
X86_ASSEMBLY_PATCH_LABEL gPatchSmmCr3;\r
-extern UINT32 gSmmCr4;\r
+extern UINT32 mSmmCr4;\r
+X86_ASSEMBLY_PATCH_LABEL gPatchSmmCr4;\r
extern UINTN gSmmInitStack;\r
\r
/**\r
extern ASM_PFX(mSmmRelocationOriginalAddress)\r
\r
global ASM_PFX(gPatchSmmCr3)\r
-global ASM_PFX(gSmmCr4)\r
+global ASM_PFX(gPatchSmmCr4)\r
global ASM_PFX(gSmmCr0)\r
global ASM_PFX(gSmmJmpAddr)\r
global ASM_PFX(gSmmInitStack)\r
ASM_PFX(gPatchSmmCr3):\r
mov cr3, eax\r
o32 lgdt [cs:ebp + (ASM_PFX(gcSmiInitGdtr) - ASM_PFX(SmmStartup))]\r
- DB 0x66, 0xb8 ; mov eax, imm32\r
-ASM_PFX(gSmmCr4): DD 0\r
+ mov eax, strict dword 0 ; source operand will be patched\r
+ASM_PFX(gPatchSmmCr4):\r
or ah, 2 ; enable XMM registers access\r
mov cr4, eax\r
mov ecx, 0xc0000080 ; IA32_EFER MSR\r