Bit SMM_Code_Access_Chk (SMM-RO) in MSR_SMM_MCA_CAP is defined in SDM.
If set to 1 indicates that the SMM code access restriction is supported and the
MSR_SMM_FEATURE_CONTROL is supported.
If this bit is not set, we needn't to access register SmmFetureControl.
Otherwise, #GP exception may happen.
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18905
6f19259b-4bc3-4df7-8a09-
765794883524
NewSmmFeatureControlMsr = SmmFeatureControlMsr;\r
if (mSmmCodeAccessCheckEnable) {\r
NewSmmFeatureControlMsr |= SMM_CODE_CHK_EN_BIT;\r
- }\r
- if (FeaturePcdGet (PcdCpuSmmFeatureControlMsrLock)) {\r
- NewSmmFeatureControlMsr |= SMM_FEATURE_CONTROL_LOCK_BIT;\r
+ if (FeaturePcdGet (PcdCpuSmmFeatureControlMsrLock)) {\r
+ NewSmmFeatureControlMsr |= SMM_FEATURE_CONTROL_LOCK_BIT;\r
+ }\r
}\r
\r
//\r
//\r
if ((AsmReadMsr64 (EFI_MSR_SMM_MCA_CAP) & SMM_CODE_ACCESS_CHK_BIT) == 0) {\r
mSmmCodeAccessCheckEnable = FALSE;\r
- }\r
-\r
- //\r
- // If the SMM Code Access Check feature is disabled and the Feature Control MSR\r
- // is not being locked, then no additional work is required\r
- //\r
- if (!mSmmCodeAccessCheckEnable && !FeaturePcdGet (PcdCpuSmmFeatureControlMsrLock)) {\r
return;\r
}\r
\r