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