1 /* $Id: ptrace.h,v 1.13 1997/09/17 17:27:51 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)
92 #define REGWIN_SZ sizeof(struct reg_window)
94 #define TRACEREG32_SZ sizeof(struct pt_regs32)
95 #define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
96 #define REGWIN32_SZ sizeof(struct reg_window32)
99 #define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
100 #define instruction_pointer(regs) ((regs)->tpc)
101 extern void show_regs(struct pt_regs
*);
104 #else /* __ASSEMBLY__ */
105 /* For assembly code. */
106 #define TRACEREG_SZ 0xa0
107 #define STACKFRAME_SZ 0xc0
108 #define REGWIN_SZ 0x80
110 #define TRACEREG32_SZ 0x50
111 #define STACKFRAME32_SZ 0x60
112 #define REGWIN32_SZ 0x40
114 #include <asm/asm_offsets.h>
118 #define STACK_BIAS 2047
121 /* These are for pt_regs. */
122 #define PT_V9_G0 0x00
123 #define PT_V9_G1 0x08
124 #define PT_V9_G2 0x10
125 #define PT_V9_G3 0x18
126 #define PT_V9_G4 0x20
127 #define PT_V9_G5 0x28
128 #define PT_V9_G6 0x30
129 #define PT_V9_G7 0x38
130 #define PT_V9_I0 0x40
131 #define PT_V9_I1 0x48
132 #define PT_V9_I2 0x50
133 #define PT_V9_I3 0x58
134 #define PT_V9_I4 0x60
135 #define PT_V9_I5 0x68
136 #define PT_V9_I6 0x70
137 #define PT_V9_FP PT_V9_I6
138 #define PT_V9_I7 0x78
139 #define PT_V9_TSTATE 0x80
140 #define PT_V9_TPC 0x88
141 #define PT_V9_TNPC 0x90
143 #define PT_V9_FPRS 0x9c
144 #define PT_TSTATE PT_V9_TSTATE
145 #define PT_TPC PT_V9_TPC
146 #define PT_TNPC PT_V9_TNPC
148 /* These for pt_regs32. */
172 /* Reg_window offsets */
173 #define RW_V9_L0 0x00
174 #define RW_V9_L1 0x08
175 #define RW_V9_L2 0x10
176 #define RW_V9_L3 0x18
177 #define RW_V9_L4 0x20
178 #define RW_V9_L5 0x28
179 #define RW_V9_L6 0x30
180 #define RW_V9_L7 0x38
181 #define RW_V9_I0 0x40
182 #define RW_V9_I1 0x48
183 #define RW_V9_I2 0x50
184 #define RW_V9_I3 0x58
185 #define RW_V9_I4 0x60
186 #define RW_V9_I5 0x68
187 #define RW_V9_I6 0x70
188 #define RW_V9_I7 0x78
207 /* Stack_frame offsets */
208 #define SF_V9_L0 0x00
209 #define SF_V9_L1 0x08
210 #define SF_V9_L2 0x10
211 #define SF_V9_L3 0x18
212 #define SF_V9_L4 0x20
213 #define SF_V9_L5 0x28
214 #define SF_V9_L6 0x30
215 #define SF_V9_L7 0x38
216 #define SF_V9_I0 0x40
217 #define SF_V9_I1 0x48
218 #define SF_V9_I2 0x50
219 #define SF_V9_I3 0x58
220 #define SF_V9_I4 0x60
221 #define SF_V9_I5 0x68
222 #define SF_V9_FP 0x70
223 #define SF_V9_PC 0x78
224 #define SF_V9_RETP 0x80
225 #define SF_V9_XARG0 0x88
226 #define SF_V9_XARG1 0x90
227 #define SF_V9_XARG2 0x98
228 #define SF_V9_XARG3 0xa0
229 #define SF_V9_XARG4 0xa8
230 #define SF_V9_XARG5 0xb0
231 #define SF_V9_XXARG 0xb8
250 #define SF_XARG0 0x44
251 #define SF_XARG1 0x48
252 #define SF_XARG2 0x4c
253 #define SF_XARG3 0x50
254 #define SF_XARG4 0x54
255 #define SF_XARG5 0x58
256 #define SF_XXARG 0x5c
258 /* Stuff for the ptrace system call */
259 #define PTRACE_SUNATTACH 10
260 #define PTRACE_SUNDETACH 11
261 #define PTRACE_GETREGS 12
262 #define PTRACE_SETREGS 13
263 #define PTRACE_GETFPREGS 14
264 #define PTRACE_SETFPREGS 15
265 #define PTRACE_READDATA 16
266 #define PTRACE_WRITEDATA 17
267 #define PTRACE_READTEXT 18
268 #define PTRACE_WRITETEXT 19
269 #define PTRACE_GETFPAREGS 20
270 #define PTRACE_SETFPAREGS 21
272 /* There are for debugging 64-bit processes, either from a 32 or 64 bit
273 * parent. Thus their compliments are for debugging 32-bit processes only.
276 #define PTRACE_GETREGS64 22
277 #define PTRACE_SETREGS64 23
278 /* PTRACE_SYSCALL is 24 */
279 #define PTRACE_GETFPREGS64 25
280 #define PTRACE_SETFPREGS64 26
282 #define PTRACE_GETUCODE 29 /* stupid bsd-ism */
284 /* These are for 32-bit processes debugging 64-bit ones.
285 * Here addr and addr2 are passed in %g2 and %g3 respectively.
287 #define PTRACE_PEEKTEXT64 (30 + PTRACE_PEEKTEXT)
288 #define PTRACE_POKETEXT64 (30 + PTRACE_POKETEXT)
289 #define PTRACE_PEEKDATA64 (30 + PTRACE_PEEKDATA)
290 #define PTRACE_POKEDATA64 (30 + PTRACE_POKEDATA)
291 #define PTRACE_READDATA64 (30 + PTRACE_READDATA)
292 #define PTRACE_WRITEDATA64 (30 + PTRACE_WRITEDATA)
293 #define PTRACE_READTEXT64 (30 + PTRACE_READTEXT)
294 #define PTRACE_WRITETEXT64 (30 + PTRACE_WRITETEXT)
296 #endif /* !(_SPARC64_PTRACE_H) */