UefiCpuPkg: Only change CR4.CET bit for enable and disable CET.

Signed-off-by: Sheng Wei <w.sheng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Tan Dun <dun.tan@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Sheng Wei 2023-11-09 16:41:05 +08:00 committed by mergify[bot]
parent 3018685da8
commit fd1dd8568c
2 changed files with 14 additions and 6 deletions

View File

@ -237,7 +237,9 @@ CetInterruptDone:
bts ecx, 16 ; set WP
mov cr0, ecx
mov eax, 0x668 | CR4_CET
; set CR4.CET bit for enable CET
mov eax, cr4
bts eax, CR4_CET_BIT
mov cr4, eax
setssbsy
@ -264,8 +266,10 @@ CetDone:
cmp al, 0
jz CetDone2
mov eax, 0x668
mov cr4, eax ; disable CET
; clear CR4.CET bit for disable CET
mov eax, cr4
btr eax, CR4_CET_BIT
mov cr4, eax
mov ecx, MSR_IA32_PL0_SSP
pop eax

View File

@ -263,7 +263,9 @@ CetInterruptDone:
bts ecx, 16 ; set WP
mov cr0, rcx
mov eax, 0x668 | CR4_CET
; set CR4.CET bit for enable CET
mov rax, cr4
bts rax, CR4_CET_BIT
mov cr4, rax
setssbsy
@ -308,8 +310,10 @@ mCetSupportedAbsAddr:
cmp al, 0
jz CetDone2
mov eax, 0x668
mov cr4, rax ; disable CET
; clear CR4.CET bit for disable CET
mov rax, cr4
btr rax, CR4_CET_BIT
mov cr4, rax
mov ecx, MSR_IA32_INTERRUPT_SSP_TABLE_ADDR
pop rax