2 * Some macros to handle stack frames in assembly.
12 /* arguments: interrupts/non tracing syscalls only save upto here*/
22 #define ORIG_RAX 120 /* + error_code */
23 /* end of arguments */
24 /* cpu exception frame or undefined in case of fast syscall. */
31 #define SWFRAME ORIG_RAX
33 .macro SAVE_ARGS addskip
=0,norcx
=0,nor891011
=0
34 subq $
9*8+\addskip
,%rsp
35 CFI_ADJUST_CFA_OFFSET
9*8+\addskip
37 CFI_REL_OFFSET rdi
,8*8
39 CFI_REL_OFFSET rsi
,7*8
41 CFI_REL_OFFSET rdx
,6*8
45 CFI_REL_OFFSET rcx
,5*8
48 CFI_REL_OFFSET rax
,4*8
56 CFI_REL_OFFSET r10
,1*8
58 CFI_REL_OFFSET r11
,0*8
63 .macro RESTORE_ARGS skiprax
=0,addskip
=0,skiprcx
=0,skipr11
=0,skipr8910
=0,skiprdx
=0
97 .if ARG_SKIP
+\addskip
> 0
98 addq $ARG_SKIP
+\addskip
,%rsp
99 CFI_ADJUST_CFA_OFFSET
-(ARG_SKIP
+\addskip
)
103 .macro LOAD_ARGS offset
104 movq \
offset(%rsp
),%r11
105 movq \offset
+8(%rsp
),%r10
106 movq \offset
+16(%rsp
),%r9
107 movq \offset
+24(%rsp
),%r8
108 movq \offset
+40(%rsp
),%rcx
109 movq \offset
+48(%rsp
),%rdx
110 movq \offset
+56(%rsp
),%rsi
111 movq \offset
+64(%rsp
),%rdi
112 movq \offset
+72(%rsp
),%rax
115 #define REST_SKIP 6*8
118 CFI_ADJUST_CFA_OFFSET REST_SKIP
120 CFI_REL_OFFSET rbx
,5*8
122 CFI_REL_OFFSET rbp
,4*8
124 CFI_REL_OFFSET r12
,3*8
126 CFI_REL_OFFSET r13
,2*8
128 CFI_REL_OFFSET r14
,1*8
130 CFI_REL_OFFSET r15
,0*8
147 CFI_ADJUST_CFA_OFFSET
-(REST_SKIP
)
155 .macro RESTORE_ALL addskip
=0
157 RESTORE_ARGS
0,\addskip