PushPopRegsNasm.inc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ;------------------------------------------------------------------------------
  2. ;
  3. ; Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
  4. ; SPDX-License-Identifier: BSD-2-Clause-Patent
  5. ;
  6. ; Abstract:
  7. ;
  8. ; Provide macro to push/pop registers in X64
  9. ;
  10. ;------------------------------------------------------------------------------
  11. ;-----------------------------------------------------------------------------
  12. ; Macro: PUSHA_64
  13. ;
  14. ; Description: Saves all registers on stack
  15. ;
  16. ; Input: None
  17. ;
  18. ; Output: None
  19. ;-----------------------------------------------------------------------------
  20. %macro PUSHA_64 0
  21. push r8
  22. push r9
  23. push r10
  24. push r11
  25. push r12
  26. push r13
  27. push r14
  28. push r15
  29. push rax
  30. push rcx
  31. push rdx
  32. push rbx
  33. push rsp
  34. push rbp
  35. push rsi
  36. push rdi
  37. %endmacro
  38. ;-----------------------------------------------------------------------------
  39. ; Macro: POPA_64
  40. ;
  41. ; Description: Restores all registers from stack
  42. ;
  43. ; Input: None
  44. ;
  45. ; Output: None
  46. ;-----------------------------------------------------------------------------
  47. %macro POPA_64 0
  48. pop rdi
  49. pop rsi
  50. pop rbp
  51. pop rsp
  52. pop rbx
  53. pop rdx
  54. pop rcx
  55. pop rax
  56. pop r15
  57. pop r14
  58. pop r13
  59. pop r12
  60. pop r11
  61. pop r10
  62. pop r9
  63. pop r8
  64. %endmacro