#ifndef _KERNEL_AMD64_REGSASM_H
#define _KERNEL_AMD64_REGSASM_H

#define push_regs                                                                                  \
  pushq % rax;                                                                                     \
  pushq % rcx;                                                                                     \
  pushq % rdx;                                                                                     \
  pushq % rsi;                                                                                     \
  pushq % rdi;                                                                                     \
  pushq % rbp;                                                                                     \
  pushq % rbx;                                                                                     \
  pushq % r8;                                                                                      \
  pushq % r9;                                                                                      \
  pushq % r10;                                                                                     \
  pushq % r11;                                                                                     \
  pushq % r12;                                                                                     \
  pushq % r13;                                                                                     \
  pushq % r14;                                                                                     \
  pushq % r15;

#define pop_regs                                                                                   \
  popq % r15;                                                                                      \
  popq % r14;                                                                                      \
  popq % r13;                                                                                      \
  popq % r12;                                                                                      \
  popq % r11;                                                                                      \
  popq % r10;                                                                                      \
  popq % r9;                                                                                       \
  popq % r8;                                                                                       \
  popq % rbx;                                                                                      \
  popq % rbp;                                                                                      \
  popq % rdi;                                                                                      \
  popq % rsi;                                                                                      \
  popq % rdx;                                                                                      \
  popq % rcx;                                                                                      \
  popq % rax;

#define pop_regs_skip_rax                                                                          \
  popq % r15;                                                                                      \
  popq % r14;                                                                                      \
  popq % r13;                                                                                      \
  popq % r12;                                                                                      \
  popq % r11;                                                                                      \
  popq % r10;                                                                                      \
  popq % r9;                                                                                       \
  popq % r8;                                                                                       \
  popq % rbx;                                                                                      \
  popq % rbp;                                                                                      \
  popq % rdi;                                                                                      \
  popq % rsi;                                                                                      \
  popq % rdx;                                                                                      \
  popq % rcx;                                                                                      \
  addq $8, % rsp

#endif // _KERNEL_AMD64_REGSASM_H
