]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Cet.nasm
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / Ia32 / Cet.nasm
1 ;------------------------------------------------------------------------------ ;
2 ; Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
3 ; SPDX-License-Identifier: BSD-2-Clause-Patent
4 ;
5 ;-------------------------------------------------------------------------------
6
7 %include "Nasm.inc"
8
9 SECTION .text
10
11 global ASM_PFX(DisableCet)
12 ASM_PFX(DisableCet):
13
14 ; Skip the pushed data for call
15 mov eax, 1
16 incsspd eax
17
18 mov eax, cr4
19 btr eax, 23 ; clear CET
20 mov cr4, eax
21 ret
22
23 global ASM_PFX(EnableCet)
24 ASM_PFX(EnableCet):
25
26 mov eax, cr4
27 bts eax, 23 ; set CET
28 mov cr4, eax
29
30 ; use jmp to skip the check for ret
31 pop eax
32 jmp eax
33