sparc64: remove CVS keywords
[firewire-audio.git] / include / asm-sparc64 / ptrace.h
blob90972a5ada59f8e3b324f430587922c7cbb2a562
1 #ifndef _SPARC64_PTRACE_H
2 #define _SPARC64_PTRACE_H
4 #include <asm/pstate.h>
6 /* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
10 /* This magic value must have the low 9 bits clear,
11 * as that is where we encode the %tt value, see below.
13 #define PT_REGS_MAGIC 0x57ac6c00
15 #ifndef __ASSEMBLY__
17 #include <linux/types.h>
19 struct pt_regs {
20 unsigned long u_regs[16]; /* globals and ins */
21 unsigned long tstate;
22 unsigned long tpc;
23 unsigned long tnpc;
24 unsigned int y;
26 /* We encode a magic number, PT_REGS_MAGIC, along
27 * with the %tt (trap type) register value at trap
28 * entry time. The magic number allows us to identify
29 * accurately a trap stack frame in the stack
30 * unwinder, and the %tt value allows us to test
31 * things like "in a system call" etc. for an arbitray
32 * process.
34 * The PT_REGS_MAGIC is choosen such that it can be
35 * loaded completely using just a sethi instruction.
37 unsigned int magic;
40 static inline int pt_regs_trap_type(struct pt_regs *regs)
42 return regs->magic & 0x1ff;
45 static inline bool pt_regs_is_syscall(struct pt_regs *regs)
47 return (regs->tstate & TSTATE_SYSCALL);
50 static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
52 return (regs->tstate &= ~TSTATE_SYSCALL);
55 struct pt_regs32 {
56 unsigned int psr;
57 unsigned int pc;
58 unsigned int npc;
59 unsigned int y;
60 unsigned int u_regs[16]; /* globals and ins */
63 #define UREG_G0 0
64 #define UREG_G1 1
65 #define UREG_G2 2
66 #define UREG_G3 3
67 #define UREG_G4 4
68 #define UREG_G5 5
69 #define UREG_G6 6
70 #define UREG_G7 7
71 #define UREG_I0 8
72 #define UREG_I1 9
73 #define UREG_I2 10
74 #define UREG_I3 11
75 #define UREG_I4 12
76 #define UREG_I5 13
77 #define UREG_I6 14
78 #define UREG_I7 15
79 #define UREG_FP UREG_I6
80 #define UREG_RETPC UREG_I7
82 /* A V9 register window */
83 struct reg_window {
84 unsigned long locals[8];
85 unsigned long ins[8];
88 /* A 32-bit register window. */
89 struct reg_window32 {
90 unsigned int locals[8];
91 unsigned int ins[8];
94 /* A V9 Sparc stack frame */
95 struct sparc_stackf {
96 unsigned long locals[8];
97 unsigned long ins[6];
98 struct sparc_stackf *fp;
99 unsigned long callers_pc;
100 char *structptr;
101 unsigned long xargs[6];
102 unsigned long xxargs[1];
105 /* A 32-bit Sparc stack frame */
106 struct sparc_stackf32 {
107 unsigned int locals[8];
108 unsigned int ins[6];
109 unsigned int fp;
110 unsigned int callers_pc;
111 unsigned int structptr;
112 unsigned int xargs[6];
113 unsigned int xxargs[1];
116 struct sparc_trapf {
117 unsigned long locals[8];
118 unsigned long ins[8];
119 unsigned long _unused;
120 struct pt_regs *regs;
123 #define TRACEREG_SZ sizeof(struct pt_regs)
124 #define STACKFRAME_SZ sizeof(struct sparc_stackf)
126 #define TRACEREG32_SZ sizeof(struct pt_regs32)
127 #define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
129 #ifdef __KERNEL__
131 #define __ARCH_WANT_COMPAT_SYS_PTRACE
133 #define force_successful_syscall_return() \
134 do { current_thread_info()->syscall_noerror = 1; \
135 } while (0)
136 #define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
137 #define instruction_pointer(regs) ((regs)->tpc)
138 #define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
139 #ifdef CONFIG_SMP
140 extern unsigned long profile_pc(struct pt_regs *);
141 #else
142 #define profile_pc(regs) instruction_pointer(regs)
143 #endif
144 extern void show_regs(struct pt_regs *);
145 extern void __show_regs(struct pt_regs *);
146 #endif
148 #else /* __ASSEMBLY__ */
149 /* For assembly code. */
150 #define TRACEREG_SZ 0xa0
151 #define STACKFRAME_SZ 0xc0
153 #define TRACEREG32_SZ 0x50
154 #define STACKFRAME32_SZ 0x60
155 #endif
157 #ifdef __KERNEL__
158 #define STACK_BIAS 2047
159 #endif
161 /* These are for pt_regs. */
162 #define PT_V9_G0 0x00
163 #define PT_V9_G1 0x08
164 #define PT_V9_G2 0x10
165 #define PT_V9_G3 0x18
166 #define PT_V9_G4 0x20
167 #define PT_V9_G5 0x28
168 #define PT_V9_G6 0x30
169 #define PT_V9_G7 0x38
170 #define PT_V9_I0 0x40
171 #define PT_V9_I1 0x48
172 #define PT_V9_I2 0x50
173 #define PT_V9_I3 0x58
174 #define PT_V9_I4 0x60
175 #define PT_V9_I5 0x68
176 #define PT_V9_I6 0x70
177 #define PT_V9_FP PT_V9_I6
178 #define PT_V9_I7 0x78
179 #define PT_V9_TSTATE 0x80
180 #define PT_V9_TPC 0x88
181 #define PT_V9_TNPC 0x90
182 #define PT_V9_Y 0x98
183 #define PT_V9_MAGIC 0x9c
184 #define PT_TSTATE PT_V9_TSTATE
185 #define PT_TPC PT_V9_TPC
186 #define PT_TNPC PT_V9_TNPC
188 /* These for pt_regs32. */
189 #define PT_PSR 0x0
190 #define PT_PC 0x4
191 #define PT_NPC 0x8
192 #define PT_Y 0xc
193 #define PT_G0 0x10
194 #define PT_WIM PT_G0
195 #define PT_G1 0x14
196 #define PT_G2 0x18
197 #define PT_G3 0x1c
198 #define PT_G4 0x20
199 #define PT_G5 0x24
200 #define PT_G6 0x28
201 #define PT_G7 0x2c
202 #define PT_I0 0x30
203 #define PT_I1 0x34
204 #define PT_I2 0x38
205 #define PT_I3 0x3c
206 #define PT_I4 0x40
207 #define PT_I5 0x44
208 #define PT_I6 0x48
209 #define PT_FP PT_I6
210 #define PT_I7 0x4c
212 /* Reg_window offsets */
213 #define RW_V9_L0 0x00
214 #define RW_V9_L1 0x08
215 #define RW_V9_L2 0x10
216 #define RW_V9_L3 0x18
217 #define RW_V9_L4 0x20
218 #define RW_V9_L5 0x28
219 #define RW_V9_L6 0x30
220 #define RW_V9_L7 0x38
221 #define RW_V9_I0 0x40
222 #define RW_V9_I1 0x48
223 #define RW_V9_I2 0x50
224 #define RW_V9_I3 0x58
225 #define RW_V9_I4 0x60
226 #define RW_V9_I5 0x68
227 #define RW_V9_I6 0x70
228 #define RW_V9_I7 0x78
230 #define RW_L0 0x00
231 #define RW_L1 0x04
232 #define RW_L2 0x08
233 #define RW_L3 0x0c
234 #define RW_L4 0x10
235 #define RW_L5 0x14
236 #define RW_L6 0x18
237 #define RW_L7 0x1c
238 #define RW_I0 0x20
239 #define RW_I1 0x24
240 #define RW_I2 0x28
241 #define RW_I3 0x2c
242 #define RW_I4 0x30
243 #define RW_I5 0x34
244 #define RW_I6 0x38
245 #define RW_I7 0x3c
247 /* Stack_frame offsets */
248 #define SF_V9_L0 0x00
249 #define SF_V9_L1 0x08
250 #define SF_V9_L2 0x10
251 #define SF_V9_L3 0x18
252 #define SF_V9_L4 0x20
253 #define SF_V9_L5 0x28
254 #define SF_V9_L6 0x30
255 #define SF_V9_L7 0x38
256 #define SF_V9_I0 0x40
257 #define SF_V9_I1 0x48
258 #define SF_V9_I2 0x50
259 #define SF_V9_I3 0x58
260 #define SF_V9_I4 0x60
261 #define SF_V9_I5 0x68
262 #define SF_V9_FP 0x70
263 #define SF_V9_PC 0x78
264 #define SF_V9_RETP 0x80
265 #define SF_V9_XARG0 0x88
266 #define SF_V9_XARG1 0x90
267 #define SF_V9_XARG2 0x98
268 #define SF_V9_XARG3 0xa0
269 #define SF_V9_XARG4 0xa8
270 #define SF_V9_XARG5 0xb0
271 #define SF_V9_XXARG 0xb8
273 #define SF_L0 0x00
274 #define SF_L1 0x04
275 #define SF_L2 0x08
276 #define SF_L3 0x0c
277 #define SF_L4 0x10
278 #define SF_L5 0x14
279 #define SF_L6 0x18
280 #define SF_L7 0x1c
281 #define SF_I0 0x20
282 #define SF_I1 0x24
283 #define SF_I2 0x28
284 #define SF_I3 0x2c
285 #define SF_I4 0x30
286 #define SF_I5 0x34
287 #define SF_FP 0x38
288 #define SF_PC 0x3c
289 #define SF_RETP 0x40
290 #define SF_XARG0 0x44
291 #define SF_XARG1 0x48
292 #define SF_XARG2 0x4c
293 #define SF_XARG3 0x50
294 #define SF_XARG4 0x54
295 #define SF_XARG5 0x58
296 #define SF_XXARG 0x5c
298 /* Stuff for the ptrace system call */
299 #define PTRACE_SPARC_DETACH 11
300 #define PTRACE_GETREGS 12
301 #define PTRACE_SETREGS 13
302 #define PTRACE_GETFPREGS 14
303 #define PTRACE_SETFPREGS 15
304 #define PTRACE_READDATA 16
305 #define PTRACE_WRITEDATA 17
306 #define PTRACE_READTEXT 18
307 #define PTRACE_WRITETEXT 19
308 #define PTRACE_GETFPAREGS 20
309 #define PTRACE_SETFPAREGS 21
311 /* There are for debugging 64-bit processes, either from a 32 or 64 bit
312 * parent. Thus their complements are for debugging 32-bit processes only.
315 #define PTRACE_GETREGS64 22
316 #define PTRACE_SETREGS64 23
317 /* PTRACE_SYSCALL is 24 */
318 #define PTRACE_GETFPREGS64 25
319 #define PTRACE_SETFPREGS64 26
321 #endif /* !(_SPARC64_PTRACE_H) */