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