]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Cet.nasm
UefiCpuPkg: Replace Opcode with the corresponding instructions.
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / Ia32 / Cet.nasm
... / ...
CommitLineData
1;------------------------------------------------------------------------------ ;\r
2; Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
3; SPDX-License-Identifier: BSD-2-Clause-Patent\r
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
16 incsspd eax\r
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