diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm index 87a31b71a9..d84e81505e 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm @@ -202,11 +202,21 @@ ASM_PFX(mPatchCetSupported): push edx push eax + mov ecx, MSR_IA32_U_CET + rdmsr + push edx + push eax + mov ecx, MSR_IA32_PL0_SSP rdmsr push edx push eax + mov ecx, MSR_IA32_U_CET + xor eax, eax + xor edx, edx + wrmsr + mov ecx, MSR_IA32_S_CET mov eax, MSR_IA32_CET_SH_STK_EN xor edx, edx @@ -276,6 +286,11 @@ CetDone: pop edx wrmsr + mov ecx, MSR_IA32_U_CET + pop eax + pop edx + wrmsr + mov ecx, MSR_IA32_S_CET pop eax pop edx diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm index e7c51e6950..644366ba19 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm @@ -217,6 +217,11 @@ ASM_PFX(mPatchCetSupported): push rdx push rax + mov ecx, MSR_IA32_U_CET + rdmsr + push rdx + push rax + mov ecx, MSR_IA32_PL0_SSP rdmsr push rdx @@ -227,6 +232,11 @@ ASM_PFX(mPatchCetSupported): push rdx push rax + mov ecx, MSR_IA32_U_CET + xor eax, eax + xor edx, edx + wrmsr + mov ecx, MSR_IA32_S_CET mov eax, MSR_IA32_CET_SH_STK_EN xor edx, edx @@ -325,6 +335,11 @@ mCetSupportedAbsAddr: pop rdx wrmsr + mov ecx, MSR_IA32_U_CET + pop rax + pop rdx + wrmsr + mov ecx, MSR_IA32_S_CET pop rax pop rdx