]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Cet.nasm
UefiCpuPkg/PiSmmCpu: Add Shadow Stack Support for X86 SMM.
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / Ia32 / 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
15SECTION .text\r
16\r
17global ASM_PFX(DisableCet)\r
18ASM_PFX(DisableCet):\r
19\r
20 ; Skip the pushed data for call\r
21 mov eax, 1\r
22 INCSSP_EAX\r
23\r
24 mov eax, cr4\r
25 btr eax, 23 ; clear CET\r
26 mov cr4, eax\r
27 ret\r
28\r
29global ASM_PFX(EnableCet)\r
30ASM_PFX(EnableCet):\r
31\r
32 mov eax, cr4\r
33 bts eax, 23 ; set CET\r
34 mov cr4, eax\r
35\r
36 ; use jmp to skip the check for ret\r
37 pop eax\r
38 jmp eax\r
39\r