]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/Include/PushPopRegsNasm.inc
IntelFsp2Pkg: BaseFspSwitchStackLib Support for X64
[mirror_edk2.git] / IntelFsp2Pkg / Include / PushPopRegsNasm.inc
diff --git a/IntelFsp2Pkg/Include/PushPopRegsNasm.inc b/IntelFsp2Pkg/Include/PushPopRegsNasm.inc
new file mode 100644 (file)
index 0000000..ec10394
--- /dev/null
@@ -0,0 +1,67 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+; SPDX-License-Identifier: BSD-2-Clause-Patent\r
+;\r
+; Abstract:\r
+;\r
+;   Provide macro to push/pop registers in X64\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+;-----------------------------------------------------------------------------\r
+;  Macro:        PUSHA_64\r
+;\r
+;  Description:  Saves all registers on stack\r
+;\r
+;  Input:        None\r
+;\r
+;  Output:       None\r
+;-----------------------------------------------------------------------------\r
+%macro PUSHA_64   0\r
+  push    r8\r
+  push    r9\r
+  push    r10\r
+  push    r11\r
+  push    r12\r
+  push    r13\r
+  push    r14\r
+  push    r15\r
+  push    rax\r
+  push    rcx\r
+  push    rdx\r
+  push    rbx\r
+  push    rsp\r
+  push    rbp\r
+  push    rsi\r
+  push    rdi\r
+%endmacro\r
+\r
+;-----------------------------------------------------------------------------\r
+;  Macro:        POPA_64\r
+;\r
+;  Description:  Restores all registers from stack\r
+;\r
+;  Input:        None\r
+;\r
+;  Output:       None\r
+;-----------------------------------------------------------------------------\r
+%macro POPA_64   0\r
+  pop    rdi\r
+  pop    rsi\r
+  pop    rbp\r
+  pop    rsp\r
+  pop    rbx\r
+  pop    rdx\r
+  pop    rcx\r
+  pop    rax\r
+  pop    r15\r
+  pop    r14\r
+  pop    r13\r
+  pop    r12\r
+  pop    r11\r
+  pop    r10\r
+  pop    r9\r
+  pop    r8\r
+%endmacro\r
+\r