Files
system76-edk2/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Cet.nasm
Jason 2aa107c0aa UefiCpuPkg: Replace Opcode with the corresponding instructions.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
(tool link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)

Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
2022-03-01 01:45:47 +00:00

34 lines
794 B
NASM

;------------------------------------------------------------------------------ ;
; Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;-------------------------------------------------------------------------------
%include "Nasm.inc"
SECTION .text
global ASM_PFX(DisableCet)
ASM_PFX(DisableCet):
; Skip the pushed data for call
mov eax, 1
incsspd eax
mov eax, cr4
btr eax, 23 ; clear CET
mov cr4, eax
ret
global ASM_PFX(EnableCet)
ASM_PFX(EnableCet):
mov eax, cr4
bts eax, 23 ; set CET
mov cr4, eax
; use jmp to skip the check for ret
pop eax
jmp eax