summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
diff options
context:
space:
mode:
authorWenxing Hou <wenxing.hou@intel.com>2021-08-24 16:11:11 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-09-01 03:38:06 +0000
commit5d34cc49d5d348012fe8acf9fb618826bd541a7c (patch)
treeea16ab6ae03f009aacf730d293847b1577d10bed /UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
parentf0fe55bca4651734abf1752a1d7c69fb5bee00b9 (diff)
downloadedk2-5d34cc49d5d348012fe8acf9fb618826bd541a7c.tar.gz
edk2-5d34cc49d5d348012fe8acf9fb618826bd541a7c.tar.bz2
edk2-5d34cc49d5d348012fe8acf9fb618826bd541a7c.zip
UefiCpuPkg/PiSmmCpuDxeSmm: Update mPatchCetSupported set condition
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3584 Function AsmCpuid should first check the value for Basic CPUID Information. The fix is to update the mPatchCetSupported judgment statement. Signed-off-by: Wenxing Hou <wenxing.hou@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Sheng W <w.sheng@intel.com> Cc: Yao Jiewen <jiewen.yao@intel.com>
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c')
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
index d7ed9ab7a7..972bdc2859 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
@@ -985,13 +985,14 @@ CheckFeatureSupported (
MSR_IA32_MISC_ENABLE_REGISTER MiscEnableMsr;
if ((PcdGet32 (PcdControlFlowEnforcementPropertyMask) != 0) && mCetSupported) {
- AsmCpuid (CPUID_EXTENDED_FUNCTION, &RegEax, NULL, NULL, NULL);
- if (RegEax <= CPUID_EXTENDED_FUNCTION) {
- mCetSupported = FALSE;
- PatchInstructionX86 (mPatchCetSupported, mCetSupported, 1);
- }
- AsmCpuidEx (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO, NULL, NULL, &RegEcx, NULL);
- if ((RegEcx & CPUID_CET_SS) == 0) {
+ AsmCpuid (CPUID_SIGNATURE, &RegEax, NULL, NULL, NULL);
+ if (RegEax >= CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS) {
+ AsmCpuidEx (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO, NULL, NULL, &RegEcx, NULL);
+ if ((RegEcx & CPUID_CET_SS) == 0) {
+ mCetSupported = FALSE;
+ PatchInstructionX86 (mPatchCetSupported, mCetSupported, 1);
+ }
+ } else {
mCetSupported = FALSE;
PatchInstructionX86 (mPatchCetSupported, mCetSupported, 1);
}