1 /* $Id: ptrace.h,v 1.14 2002/02/09 19:49:32 davem Exp $ */
2 #ifndef _SPARC64_PTRACE_H
3 #define _SPARC64_PTRACE_H
5 #include <asm/pstate.h>
7 /* This struct defines the way the registers are stored on the
8 * stack during a system call and basically all traps.
14 unsigned long u_regs
[16]; /* globals and ins */
27 unsigned int u_regs
[16]; /* globals and ins */
46 #define UREG_FP UREG_I6
47 #define UREG_RETPC UREG_I7
49 /* A V9 register window */
51 unsigned long locals
[8];
55 /* A 32-bit register window. */
57 unsigned int locals
[8];
61 /* A V9 Sparc stack frame */
63 unsigned long locals
[8];
65 struct sparc_stackf
*fp
;
66 unsigned long callers_pc
;
68 unsigned long xargs
[6];
69 unsigned long xxargs
[1];
72 /* A 32-bit Sparc stack frame */
73 struct sparc_stackf32
{
74 unsigned int locals
[8];
77 unsigned int callers_pc
;
78 unsigned int structptr
;
79 unsigned int xargs
[6];
80 unsigned int xxargs
[1];
84 unsigned long locals
[8];
86 unsigned long _unused
;
90 #define TRACEREG_SZ sizeof(struct pt_regs)
91 #define STACKFRAME_SZ sizeof(struct sparc_stackf)
93 #define TRACEREG32_SZ sizeof(struct pt_regs32)
94 #define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
98 #define __ARCH_WANT_COMPAT_SYS_PTRACE
100 #define force_successful_syscall_return() \
101 do { current_thread_info()->syscall_noerror = 1; \
103 #define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
104 #define instruction_pointer(regs) ((regs)->tpc)
105 #define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
107 extern unsigned long profile_pc(struct pt_regs
*);
109 #define profile_pc(regs) instruction_pointer(regs)
111 extern void show_regs(struct pt_regs
*);
112 extern void __show_regs(struct pt_regs
*);
115 #else /* __ASSEMBLY__ */
116 /* For assembly code. */
117 #define TRACEREG_SZ 0xa0
118 #define STACKFRAME_SZ 0xc0
120 #define TRACEREG32_SZ 0x50
121 #define STACKFRAME32_SZ 0x60
125 #define STACK_BIAS 2047
128 /* These are for pt_regs. */
129 #define PT_V9_G0 0x00
130 #define PT_V9_G1 0x08
131 #define PT_V9_G2 0x10
132 #define PT_V9_G3 0x18
133 #define PT_V9_G4 0x20
134 #define PT_V9_G5 0x28
135 #define PT_V9_G6 0x30
136 #define PT_V9_G7 0x38
137 #define PT_V9_I0 0x40
138 #define PT_V9_I1 0x48
139 #define PT_V9_I2 0x50
140 #define PT_V9_I3 0x58
141 #define PT_V9_I4 0x60
142 #define PT_V9_I5 0x68
143 #define PT_V9_I6 0x70
144 #define PT_V9_FP PT_V9_I6
145 #define PT_V9_I7 0x78
146 #define PT_V9_TSTATE 0x80
147 #define PT_V9_TPC 0x88
148 #define PT_V9_TNPC 0x90
150 #define PT_V9_FPRS 0x9c
151 #define PT_TSTATE PT_V9_TSTATE
152 #define PT_TPC PT_V9_TPC
153 #define PT_TNPC PT_V9_TNPC
155 /* These for pt_regs32. */
179 /* Reg_window offsets */
180 #define RW_V9_L0 0x00
181 #define RW_V9_L1 0x08
182 #define RW_V9_L2 0x10
183 #define RW_V9_L3 0x18
184 #define RW_V9_L4 0x20
185 #define RW_V9_L5 0x28
186 #define RW_V9_L6 0x30
187 #define RW_V9_L7 0x38
188 #define RW_V9_I0 0x40
189 #define RW_V9_I1 0x48
190 #define RW_V9_I2 0x50
191 #define RW_V9_I3 0x58
192 #define RW_V9_I4 0x60
193 #define RW_V9_I5 0x68
194 #define RW_V9_I6 0x70
195 #define RW_V9_I7 0x78
214 /* Stack_frame offsets */
215 #define SF_V9_L0 0x00
216 #define SF_V9_L1 0x08
217 #define SF_V9_L2 0x10
218 #define SF_V9_L3 0x18
219 #define SF_V9_L4 0x20
220 #define SF_V9_L5 0x28
221 #define SF_V9_L6 0x30
222 #define SF_V9_L7 0x38
223 #define SF_V9_I0 0x40
224 #define SF_V9_I1 0x48
225 #define SF_V9_I2 0x50
226 #define SF_V9_I3 0x58
227 #define SF_V9_I4 0x60
228 #define SF_V9_I5 0x68
229 #define SF_V9_FP 0x70
230 #define SF_V9_PC 0x78
231 #define SF_V9_RETP 0x80
232 #define SF_V9_XARG0 0x88
233 #define SF_V9_XARG1 0x90
234 #define SF_V9_XARG2 0x98
235 #define SF_V9_XARG3 0xa0
236 #define SF_V9_XARG4 0xa8
237 #define SF_V9_XARG5 0xb0
238 #define SF_V9_XXARG 0xb8
257 #define SF_XARG0 0x44
258 #define SF_XARG1 0x48
259 #define SF_XARG2 0x4c
260 #define SF_XARG3 0x50
261 #define SF_XARG4 0x54
262 #define SF_XARG5 0x58
263 #define SF_XXARG 0x5c
265 /* Stuff for the ptrace system call */
266 #define PTRACE_GETREGS 12
267 #define PTRACE_SETREGS 13
268 #define PTRACE_GETFPREGS 14
269 #define PTRACE_SETFPREGS 15
270 #define PTRACE_READDATA 16
271 #define PTRACE_WRITEDATA 17
272 #define PTRACE_READTEXT 18
273 #define PTRACE_WRITETEXT 19
274 #define PTRACE_GETFPAREGS 20
275 #define PTRACE_SETFPAREGS 21
277 /* There are for debugging 64-bit processes, either from a 32 or 64 bit
278 * parent. Thus their complements are for debugging 32-bit processes only.
281 #define PTRACE_GETREGS64 22
282 #define PTRACE_SETREGS64 23
283 /* PTRACE_SYSCALL is 24 */
284 #define PTRACE_GETFPREGS64 25
285 #define PTRACE_SETFPREGS64 26
287 #endif /* !(_SPARC64_PTRACE_H) */