-#define save_registers(regsptr) \
- asm ("movq %%rax,%c[rax_off](%[regs])\n\t" \
- "movq %%rbx,%c[rbx_off](%[regs])\n\t" \
- "movq %%rcx,%c[rcx_off](%[regs])\n\t" \
- "movq %%rdx,%c[rdx_off](%[regs])\n\t" \
- "movq %%rbp,%c[rbp_off](%[regs])\n\t" \
- "movq %%rsp,%c[rsp_off](%[regs])\n\t" \
- "movq %%rsi,%c[rsi_off](%[regs])\n\t" \
- "movq %%rdi,%c[rdi_off](%[regs])\n\t" \
- "movq %%r8,%c[r8_off](%[regs])\n\t" \
- "movq %%r9,%c[r9_off](%[regs])\n\t" \
- "movq %%r10,%c[r10_off](%[regs])\n\t" \
- "movq %%r11,%c[r11_off](%[regs])\n\t" \
- "movq %%r12,%c[r12_off](%[regs])\n\t" \
- "movq %%r13,%c[r13_off](%[regs])\n\t" \
- "movq %%r14,%c[r14_off](%[regs])\n\t" \
- "movq %%r15,%c[r15_off](%[regs])\n\t" \
- "movw %%cs,%c[cs_off](%[regs])\n\t" \
- "movw %%ss,%c[ss_off](%[regs])\n\t" \
- : \
- : [regs] "r" (regsptr), \
- [rax_off] "i" (offsetof(struct registers, rax)), \
- [rbx_off] "i" (offsetof(struct registers, rbx)), \
- [rcx_off] "i" (offsetof(struct registers, rcx)), \
- [rdx_off] "i" (offsetof(struct registers, rdx)), \
- [rbp_off] "i" (offsetof(struct registers, rbp)), \
- [rsp_off] "i" (offsetof(struct registers, rsp)), \
- [rsi_off] "i" (offsetof(struct registers, rsi)), \
- [rdi_off] "i" (offsetof(struct registers, rdi)), \
- [r8_off] "i" (offsetof(struct registers, r8)), \
- [r9_off] "i" (offsetof(struct registers, r9)), \
- [r10_off] "i" (offsetof(struct registers, r10)), \
- [r11_off] "i" (offsetof(struct registers, r11)), \
- [r12_off] "i" (offsetof(struct registers, r12)), \
- [r13_off] "i" (offsetof(struct registers, r13)), \
- [r14_off] "i" (offsetof(struct registers, r14)), \
- [r15_off] "i" (offsetof(struct registers, r15)), \
- [cs_off] "i" (offsetof(struct registers, cs)), \
- [ss_off] "i" (offsetof(struct registers, ss)) \
- );