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. */
33 .macro SAVE_ARGS addskip=0,norcx=0
34 subq $9*8+\addskip,%rsp
50 .macro RESTORE_ARGS skiprax=0,addskip=0,skiprcx=0
66 .if ARG_SKIP+\addskip > 0
67 addq $ARG_SKIP+\addskip,%rsp
71 .macro LOAD_ARGS offset
72 movq \offset(%rsp),%r11
73 movq \offset+8(%rsp),%r10
74 movq \offset+16(%rsp),%r9
75 movq \offset+24(%rsp),%r8
76 movq \offset+40(%rsp),%rcx
77 movq \offset+48(%rsp),%rdx
78 movq \offset+56(%rsp),%rsi
79 movq \offset+64(%rsp),%rdi
80 movq \offset+72(%rsp),%rax
109 .macro RESTORE_ALL addskip=0
111 RESTORE_ARGS 0,\addskip
114 /* push in order ss, rsp, eflags, cs, rip */
115 .macro FAKE_STACK_FRAME child_rip
118 movq %rax,5*8(%rsp) /* ss */
119 movq %rax,4*8(%rsp) /* rsp */
120 movq $(1<<9),3*8(%rsp) /* eflags - enable interrupts */
121 movq $__KERNEL_CS,2*8(%rsp) /* cs */
122 movq \child_rip,1*8(%rsp) /* rip */
123 movq %rax,(%rsp) /* orig_rax */
126 .macro UNFAKE_STACK_FRAME
134 #ifdef CONFIG_FRAME_POINTER