VOID *GuidHob;\r
BOOLEAN Build4GPageTableOnly;\r
BOOLEAN InterruptStatus;\r
+ IA32_CR0 Cr0;\r
\r
TempAcpiS3Context = 0;\r
TempEfiBootScriptExecutorVariable = 0;\r
//\r
GuidHob = GetFirstGuidHob (&gEfiAcpiVariableGuid);\r
if (GuidHob != NULL) {\r
+ //\r
+ // Below SwitchStack/AsmEnablePaging64 function has\r
+ // assumption that it's in 32 bits mode now.\r
+ // Add ASSERT code to indicate this assumption.\r
+ //\r
+ ASSERT(sizeof (UINTN) == sizeof (UINT32));\r
+\r
Status = PeiServicesLocatePpi (\r
&gPeiSmmAccessPpiGuid,\r
0,\r
//\r
SetInterruptState (InterruptStatus);\r
\r
+ Cr0.UintN = AsmReadCr0 ();\r
+ if (Cr0.Bits.PG != 0) {\r
+ //\r
+ // We're in 32-bit mode, with paging enabled. We can't set CR3 to\r
+ // the 64-bit page tables without first disabling paging.\r
+ //\r
+ Cr0.Bits.PG = 0;\r
+ AsmWriteCr0 (Cr0.UintN);\r
+ }\r
AsmWriteCr3 ((UINTN)SmmS3ResumeState->SmmS3Cr3);\r
\r
//\r
# VALID_ARCHITECTURES = IA32 X64\r
#\r
\r
+#\r
+# This module is not always workable in IA32 and X64 mode. It has below result:\r
+# when it works with SMM mode:\r
+# ===============================\r
+# SMM:used SMM:unused\r
+# PEI:IA32 works works\r
+# PEI:X64 fails works\r
+# ===============================\r
+#\r
+\r
[Sources]\r
S3Resume.c\r
\r