]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/PiSmmCpuDxeSmm/X64/Cet.nasm
StandaloneMmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / X64 / Cet.nasm
CommitLineData
3eb69b08
JY
1;------------------------------------------------------------------------------ ;\r
2; Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
3; This program and the accompanying materials\r
4; are licensed and made available under the terms and conditions of the BSD License\r
5; which accompanies this distribution. The full text of the license may be found at\r
6; http://opensource.org/licenses/bsd-license.php.\r
7;\r
8; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
9; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
10;\r
11;-------------------------------------------------------------------------------\r
12\r
13%include "Nasm.inc"\r
14\r
15DEFAULT REL\r
16SECTION .text\r
17\r
18global ASM_PFX(DisableCet)\r
19ASM_PFX(DisableCet):\r
20\r
21 ; Skip the pushed data for call\r
22 mov rax, 1\r
23 INCSSP_RAX\r
24\r
25 mov rax, cr4\r
26 btr eax, 23 ; clear CET\r
27 mov cr4, rax\r
28 ret\r
29\r
30global ASM_PFX(EnableCet)\r
31ASM_PFX(EnableCet):\r
32\r
33 mov rax, cr4\r
34 bts eax, 23 ; set CET\r
35 mov cr4, rax\r
36\r
37 ; use jmp to skip the check for ret\r
38 pop rax\r
39 jmp rax\r
40\r