aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64/calling.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-x86_64/calling.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-x86_64/calling.h')
-rw-r--r--include/asm-x86_64/calling.h156
1 files changed, 156 insertions, 0 deletions
diff --git a/include/asm-x86_64/calling.h b/include/asm-x86_64/calling.h
new file mode 100644
index 000000000000..0bc12655fa5b
--- /dev/null
+++ b/include/asm-x86_64/calling.h
@@ -0,0 +1,156 @@
1/*
2 * Some macros to handle stack frames in assembly.
3 */
4
5#include <linux/config.h>
6
7#define R15 0
8#define R14 8
9#define R13 16
10#define R12 24
11#define RBP 32
12#define RBX 40
13/* arguments: interrupts/non tracing syscalls only save upto here*/
14#define R11 48
15#define R10 56
16#define R9 64
17#define R8 72
18#define RAX 80
19#define RCX 88
20#define RDX 96
21#define RSI 104
22#define RDI 112
23#define ORIG_RAX 120 /* + error_code */
24/* end of arguments */
25/* cpu exception frame or undefined in case of fast syscall. */
26#define RIP 128
27#define CS 136
28#define EFLAGS 144
29#define RSP 152
30#define SS 160
31#define ARGOFFSET R11
32#define SWFRAME ORIG_RAX
33
34 .macro SAVE_ARGS addskip=0,norcx=0,nor891011=0
35 subq $9*8+\addskip,%rsp
36 CFI_ADJUST_CFA_OFFSET 9*8+\addskip
37 movq %rdi,8*8(%rsp)
38 CFI_REL_OFFSET rdi,8*8
39 movq %rsi,7*8(%rsp)
40 CFI_REL_OFFSET rsi,7*8
41 movq %rdx,6*8(%rsp)
42 CFI_REL_OFFSET rdx,6*8
43 .if \norcx
44 .else
45 movq %rcx,5*8(%rsp)
46 CFI_REL_OFFSET rcx,5*8
47 .endif
48 movq %rax,4*8(%rsp)
49 CFI_REL_OFFSET rax,4*8
50 .if \nor891011
51 .else
52 movq %r8,3*8(%rsp)
53 CFI_REL_OFFSET r8,3*8
54 movq %r9,2*8(%rsp)
55 CFI_REL_OFFSET r9,2*8
56 movq %r10,1*8(%rsp)
57 CFI_REL_OFFSET r10,1*8
58 movq %r11,(%rsp)
59 CFI_REL_OFFSET r11,0*8
60 .endif
61 .endm
62
63#define ARG_SKIP 9*8
64 .macro RESTORE_ARGS skiprax=0,addskip=0,skiprcx=0,skipr11=0,skipr8910=0,skiprdx=0
65 .if \skipr11
66 .else
67 movq (%rsp),%r11
68 .endif
69 .if \skipr8910
70 .else
71 movq 1*8(%rsp),%r10
72 movq 2*8(%rsp),%r9
73 movq 3*8(%rsp),%r8
74 .endif
75 .if \skiprax
76 .else
77 movq 4*8(%rsp),%rax
78 .endif
79 .if \skiprcx
80 .else
81 movq 5*8(%rsp),%rcx
82 .endif
83 .if \skiprdx
84 .else
85 movq 6*8(%rsp),%rdx
86 .endif
87 movq 7*8(%rsp),%rsi
88 movq 8*8(%rsp),%rdi
89 .if ARG_SKIP+\addskip > 0
90 addq $ARG_SKIP+\addskip,%rsp
91 CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip)
92 .endif
93 .endm
94
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
105 .endm
106
107#define REST_SKIP 6*8
108 .macro SAVE_REST
109 subq $REST_SKIP,%rsp
110 CFI_ADJUST_CFA_OFFSET REST_SKIP
111 movq %rbx,5*8(%rsp)
112 CFI_REL_OFFSET rbx,5*8
113 movq %rbp,4*8(%rsp)
114 CFI_REL_OFFSET rbp,4*8
115 movq %r12,3*8(%rsp)
116 CFI_REL_OFFSET r12,3*8
117 movq %r13,2*8(%rsp)
118 CFI_REL_OFFSET r13,2*8
119 movq %r14,1*8(%rsp)
120 CFI_REL_OFFSET r14,1*8
121 movq %r15,(%rsp)
122 CFI_REL_OFFSET r15,0*8
123 .endm
124
125 .macro RESTORE_REST
126 movq (%rsp),%r15
127 movq 1*8(%rsp),%r14
128 movq 2*8(%rsp),%r13
129 movq 3*8(%rsp),%r12
130 movq 4*8(%rsp),%rbp
131 movq 5*8(%rsp),%rbx
132 addq $REST_SKIP,%rsp
133 CFI_ADJUST_CFA_OFFSET -(REST_SKIP)
134 .endm
135
136 .macro SAVE_ALL
137 SAVE_ARGS
138 SAVE_REST
139 .endm
140
141 .macro RESTORE_ALL addskip=0
142 RESTORE_REST
143 RESTORE_ARGS 0,\addskip
144 .endm
145
146 .macro icebp
147 .byte 0xf1
148 .endm
149
150#ifdef CONFIG_FRAME_POINTER
151#define ENTER enter
152#define LEAVE leave
153#else
154#define ENTER
155#define LEAVE
156#endif