;------------------------------------------------------------------------------\r
;*\r
-;* Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+;* Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>\r
;* SPDX-License-Identifier: BSD-2-Clause-Patent\r
;*\r
;* CpuAsm.nasm\r
push rcx\r
lea rax, [setCodeSelectorLongJump]\r
push rax\r
- o64 retf\r
+ retfq\r
setCodeSelectorLongJump:\r
ret\r
\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
; Module Name:\r
; exception handler stub table\r
;\r
AsmIdtVectorBegin:\r
+%assign Vector 0\r
%rep 32\r
- db 0x6a ; push #VectorNum\r
- db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum\r
+ push byte %[Vector];\r
push eax\r
mov eax, ASM_PFX(CommonInterruptEntry)\r
jmp eax\r
+%assign Vector Vector+1\r
%endrep\r
AsmIdtVectorEnd:\r
\r
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support.\r
; edx still contains result from CPUID above\r
jz .3\r
- db 0xf, 0xae, 0x7 ;fxsave [edi]\r
+ fxsave [edi]\r
.3:\r
\r
;; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear\r
; are supported\r
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support\r
jz .4\r
- db 0xf, 0xae, 0xe ; fxrstor [esi]\r
+ fxrstor [esi]\r
.4:\r
add esp, 512\r
\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
; Module Name:\r
DoIret%[Vector]:\r
iretd\r
ASM_PFX(ExceptionTaskSwtichEntry%[Vector]):\r
- db 0x6a ; push #VectorNum\r
- db %[Vector]\r
+ push byte %[Vector]\r
mov eax, ASM_PFX(CommonTaskSwtichEntryPoint)\r
call eax\r
mov esp, eax ; Restore stack top\r
clts\r
sub esp, 512\r
mov edi, esp\r
- db 0xf, 0xae, 0x7 ;fxsave [edi]\r
+ fxsave [edi]\r
.3:\r
\r
;; UINT32 ExceptionData;\r
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support\r
jz .4\r
mov esi, esp\r
- db 0xf, 0xae, 0xe ; fxrstor [esi]\r
+ fxrstor [esi]\r
.4:\r
add esp, 512\r
\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
; Module Name:\r
ALIGN 8\r
\r
AsmIdtVectorBegin:\r
+%assign Vector 0\r
%rep 32\r
- db 0x6a ; push #VectorNum\r
- db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum\r
+ push byte %[Vector]\r
push rax\r
mov rax, ASM_PFX(CommonInterruptEntry)\r
jmp rax\r
+%assign Vector Vector+1\r
%endrep\r
AsmIdtVectorEnd:\r
\r
;; FX_SAVE_STATE_X64 FxSaveState;\r
sub rsp, 512\r
mov rdi, rsp\r
- db 0xf, 0xae, 0x7 ;fxsave [rdi]\r
+ fxsave [rdi]\r
\r
;; UEFI calling convention for x64 requires that Direction flag in EFLAGs is clear\r
cld\r
;; FX_SAVE_STATE_X64 FxSaveState;\r
\r
mov rsi, rsp\r
- db 0xf, 0xae, 0xE ; fxrstor [rsi]\r
+ fxrstor [rsi]\r
add rsp, 512\r
\r
;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
push qword [rax + 0x18] ; save EFLAGS in new location\r
mov rax, [rax] ; restore rax\r
popfq ; restore EFLAGS\r
- DB 0x48 ; prefix to composite "retq" with next "retf"\r
- retf ; far return\r
+ retfq\r
DoIret:\r
iretq\r
\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
; Module Name:\r
ALIGN 8\r
\r
AsmIdtVectorBegin:\r
+%assign Vector 0\r
%rep 32\r
- db 0x6a ; push #VectorNum\r
- db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum\r
+ push byte %[Vector]\r
push rax\r
mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptEntry)\r
jmp rax\r
+%assign Vector Vector+1\r
%endrep\r
AsmIdtVectorEnd:\r
\r
;; FX_SAVE_STATE_X64 FxSaveState;\r
sub rsp, 512\r
mov rdi, rsp\r
- db 0xf, 0xae, 0x7 ;fxsave [rdi]\r
+ fxsave [rdi]\r
\r
;; UEFI calling convention for x64 requires that Direction flag in EFLAGs is clear\r
cld\r
jz CetDone\r
; SSP should be 0xFC0 at this point\r
mov rax, 0x04 ; advance past cs:lip:prevssp;supervisor shadow stack token\r
- INCSSP_RAX ; After this SSP should be 0xFE0\r
- SAVEPREVSSP ; now the shadow stack restore token will be created at 0xFB8\r
- READSSP_RAX ; Read new SSP, SSP should be 0xFE8\r
+ incsspq rax ; After this SSP should be 0xFE0\r
+ saveprevssp ; now the shadow stack restore token will be created at 0xFB8\r
+ rdsspq rax ; Read new SSP, SSP should be 0xFE8\r
sub rax, 0x10\r
- CLRSSBSY_RAX ; Clear token at 0xFD8, SSP should be 0 after this\r
+ clrssbsy [rax] ; Clear token at 0xFD8, SSP should be 0 after this\r
sub rax, 0x20\r
- RSTORSSP_RAX ; Restore to token at 0xFB8, new SSP will be 0xFB8\r
+ rstorssp [rax] ; Restore to token at 0xFB8, new SSP will be 0xFB8\r
mov rax, 0x01 ; Pop off the new save token created\r
- INCSSP_RAX ; SSP should be 0xFC0 now\r
+ incsspq rax ; SSP should be 0xFC0 now\r
CetDone:\r
\r
cli\r
;; FX_SAVE_STATE_X64 FxSaveState;\r
\r
mov rsi, rsp\r
- db 0xf, 0xae, 0xE ; fxrstor [rsi]\r
+ fxrstor [rsi]\r
add rsp, 512\r
\r
;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
push qword [rax + 0x18] ; save EFLAGS in new location\r
mov rax, [rax] ; restore rax\r
popfq ; restore EFLAGS\r
- DB 0x48 ; prefix to composite "retq" with next "retf"\r
- retf ; far return\r
+ retfq\r
DoIret:\r
iretq\r
\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
; Module Name:\r
;\r
; Far return into 32-bit mode\r
;\r
-o64 retf\r
+ retfq\r
\r
BITS 32\r
CompatMode:\r
;\r
; Far return into 32-bit mode\r
;\r
-o64 retf\r
+ retfq\r
\r
BITS 32\r
PmEntry:\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
;-------------------------------------------------------------------------------\r
\r
; Skip the pushed data for call\r
mov eax, 1\r
- INCSSP_EAX\r
+ incsspd eax\r
\r
mov eax, cr4\r
btr eax, 23 ; clear CET\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>\r
; Copyright (c) 2020, AMD Incorporated. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
mov eax, 0x668 | CR4_CET\r
mov cr4, eax\r
\r
- SETSSBSY\r
+ setssbsy\r
\r
CetDone:\r
\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
;-------------------------------------------------------------------------------\r
\r
; Skip the pushed data for call\r
mov rax, 1\r
- INCSSP_RAX\r
+ incsspq rax\r
\r
mov rax, cr4\r
btr eax, 23 ; clear CET\r
;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>\r
; Copyright (c) 2020, AMD Incorporated. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
mov eax, 0x668 | CR4_CET\r
mov cr4, rax\r
\r
- SETSSBSY\r
+ setssbsy\r
\r
CetDone:\r
\r