2 * Some macros to handle stack frames in assembly.
5 #include <linux/config.h>
13 /* arguments: interrupts/non tracing syscalls only save upto here*/
23 #define ORIG_RAX 120 /* + error_code */
24 /* end of arguments */
25 /* cpu exception frame or undefined in case of fast syscall. */
32 #define SWFRAME ORIG_RAX
34 .macro SAVE_ARGS addskip=0,norcx=0,nor891011=0
35 subq $9*8+\addskip,%rsp
36 CFI_ADJUST_CFA_OFFSET 9*8+\addskip
38 CFI_REL_OFFSET rdi,8*8
40 CFI_REL_OFFSET rsi,7*8
42 CFI_REL_OFFSET rdx,6*8
46 CFI_REL_OFFSET rcx,5*8
49 CFI_REL_OFFSET rax,4*8
57 CFI_REL_OFFSET r10,1*8
59 CFI_REL_OFFSET r11,0*8
64 .macro RESTORE_ARGS skiprax=0,addskip=0,skiprcx=0,skipr11=0,skipr8910=0,skiprdx=0
98 .if ARG_SKIP+\addskip > 0
99 addq $ARG_SKIP+\addskip,%rsp
100 CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip)
104 .macro LOAD_ARGS offset
105 movq \offset(%rsp),%r11
106 movq \offset+8(%rsp),%r10
107 movq \offset+16(%rsp),%r9
108 movq \offset+24(%rsp),%r8
109 movq \offset+40(%rsp),%rcx
110 movq \offset+48(%rsp),%rdx
111 movq \offset+56(%rsp),%rsi
112 movq \offset+64(%rsp),%rdi
113 movq \offset+72(%rsp),%rax
116 #define REST_SKIP 6*8
119 CFI_ADJUST_CFA_OFFSET REST_SKIP
121 CFI_REL_OFFSET rbx,5*8
123 CFI_REL_OFFSET rbp,4*8
125 CFI_REL_OFFSET r12,3*8
127 CFI_REL_OFFSET r13,2*8
129 CFI_REL_OFFSET r14,1*8
131 CFI_REL_OFFSET r15,0*8
148 CFI_ADJUST_CFA_OFFSET -(REST_SKIP)
156 .macro RESTORE_ALL addskip=0
158 RESTORE_ARGS 0,\addskip