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 */
25 /* cpu exception frame or undefined in case of fast syscall. */
33 #define SWFRAME ORIG_RAX
35 .macro SAVE_ARGS addskip=0, norcx=0, nor891011=0
36 subq $9*8+\addskip, %rsp
37 CFI_ADJUST_CFA_OFFSET 9*8+\addskip
39 CFI_REL_OFFSET rdi, 8*8
41 CFI_REL_OFFSET rsi, 7*8
43 CFI_REL_OFFSET rdx, 6*8
47 CFI_REL_OFFSET rcx, 5*8
50 CFI_REL_OFFSET rax, 4*8
54 CFI_REL_OFFSET r8, 3*8
56 CFI_REL_OFFSET r9, 2*8
58 CFI_REL_OFFSET r10, 1*8
60 CFI_REL_OFFSET r11, 0*8
66 .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \
67 skipr8910=0, skiprdx=0
101 .if ARG_SKIP+\addskip > 0
102 addq $ARG_SKIP+\addskip, %rsp
103 CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip)
107 .macro LOAD_ARGS offset, skiprax=0
108 movq \offset(%rsp), %r11
109 movq \offset+8(%rsp), %r10
110 movq \offset+16(%rsp), %r9
111 movq \offset+24(%rsp), %r8
112 movq \offset+40(%rsp), %rcx
113 movq \offset+48(%rsp), %rdx
114 movq \offset+56(%rsp), %rsi
115 movq \offset+64(%rsp), %rdi
118 movq \offset+72(%rsp), %rax
122 #define REST_SKIP 6*8
125 subq $REST_SKIP, %rsp
126 CFI_ADJUST_CFA_OFFSET REST_SKIP
128 CFI_REL_OFFSET rbx, 5*8
130 CFI_REL_OFFSET rbp, 4*8
132 CFI_REL_OFFSET r12, 3*8
134 CFI_REL_OFFSET r13, 2*8
136 CFI_REL_OFFSET r14, 1*8
138 CFI_REL_OFFSET r15, 0*8
154 addq $REST_SKIP, %rsp
155 CFI_ADJUST_CFA_OFFSET -(REST_SKIP)
163 .macro RESTORE_ALL addskip=0
165 RESTORE_ARGS 0, \addskip