]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/PiSmmCpuDxeSmm: Fix failure when PcdCpuSmmDebug is TRUE
authorMichael Kinney <michael.d.kinney@intel.com>
Thu, 24 Dec 2015 00:13:47 +0000 (00:13 +0000)
committermdkinney <mdkinney@Edk2>
Thu, 24 Dec 2015 00:13:47 +0000 (00:13 +0000)
If PcdCpuSmmDebug is set to TRUE, then the first time the function
CpuSmmDebugEntry () is called during the first normal SMI, the
registers DR6 or DR7 may be set to invalid values due to gSmst
not being fully initialized yet.  Instead, use gSmmCpuPrivate that
is fully initialized for the first SMI to look up CpuSaveState
for the currently executing CPU.

Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19502 6f19259b-4bc3-4df7-8a09-765794883524

UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c

index 620b0136c5cfc2447442674de2f42f9214d8faf2..79b7c90a809be8eb72e54c269a640e0397fda154 100644 (file)
@@ -943,7 +943,7 @@ SmmStartupThisAp (
 }\r
 \r
 /**\r
-  This funciton sets DR6 & DR7 according to SMM save state, before running SMM C code.\r
+  This function sets DR6 & DR7 according to SMM save state, before running SMM C code.\r
   They are useful when you want to enable hardware breakpoints in SMM without entry SMM mode.\r
 \r
   NOTE: It might not be appreciated in runtime since it might\r
@@ -961,7 +961,7 @@ CpuSmmDebugEntry (
   SMRAM_SAVE_STATE_MAP *CpuSaveState;\r
   \r
   if (FeaturePcdGet (PcdCpuSmmDebug)) {\r
-    CpuSaveState = (SMRAM_SAVE_STATE_MAP *)gSmst->CpuSaveState[CpuIndex];\r
+    CpuSaveState = (SMRAM_SAVE_STATE_MAP *)gSmmCpuPrivate->CpuSaveState[CpuIndex];\r
     if (mSmmSaveStateRegisterLma == EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT) {\r
       AsmWriteDr6 (CpuSaveState->x86._DR6);\r
       AsmWriteDr7 (CpuSaveState->x86._DR7);\r
@@ -973,7 +973,7 @@ CpuSmmDebugEntry (
 }\r
 \r
 /**\r
-  This funciton restores DR6 & DR7 to SMM save state.\r
+  This function restores DR6 & DR7 to SMM save state.\r
 \r
   NOTE: It might not be appreciated in runtime since it might\r
         conflict with OS debugging facilities. Turn them off in RELEASE.\r
@@ -990,7 +990,7 @@ CpuSmmDebugExit (
   SMRAM_SAVE_STATE_MAP *CpuSaveState;\r
 \r
   if (FeaturePcdGet (PcdCpuSmmDebug)) {\r
-    CpuSaveState = (SMRAM_SAVE_STATE_MAP *)gSmst->CpuSaveState[CpuIndex];\r
+    CpuSaveState = (SMRAM_SAVE_STATE_MAP *)gSmmCpuPrivate->CpuSaveState[CpuIndex];\r
     if (mSmmSaveStateRegisterLma == EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT) {\r
       CpuSaveState->x86._DR7 = (UINT32)AsmReadDr7 ();\r
       CpuSaveState->x86._DR6 = (UINT32)AsmReadDr6 ();\r