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