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
89 .if ARG_SKIP+\addskip > 0
90 addq $ARG_SKIP+\addskip,%rsp
91 CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip)
95 .macro LOAD_ARGS offset
96 movq \offset(%rsp),%r11
97 movq \offset+8(%rsp),%r10
98 movq \offset+16(%rsp),%r9
99 movq \offset+24(%rsp),%r8
100 movq \offset+40(%rsp),%rcx
101 movq \offset+48(%rsp),%rdx
102 movq \offset+56(%rsp),%rsi
103 movq \offset+64(%rsp),%rdi
104 movq \offset+72(%rsp),%rax
107 #define REST_SKIP 6*8
110 CFI_ADJUST_CFA_OFFSET REST_SKIP
112 CFI_REL_OFFSET rbx,5*8
114 CFI_REL_OFFSET rbp,4*8
116 CFI_REL_OFFSET r12,3*8
118 CFI_REL_OFFSET r13,2*8
120 CFI_REL_OFFSET r14,1*8
122 CFI_REL_OFFSET r15,0*8
133 CFI_ADJUST_CFA_OFFSET -(REST_SKIP)
141 .macro RESTORE_ALL addskip=0
143 RESTORE_ARGS 0,\addskip
150 #ifdef CONFIG_FRAME_POINTER