1
2 #ifndef _SPARC_PTRACE_H
3 #define _SPARC_PTRACE_H
4
5 #include <asm/psr.h>
6
7
8
9
10
11 #ifndef __ASSEMBLY__
12
13 struct pt_regs {
14 unsigned long psr;
15 unsigned long pc;
16 unsigned long npc;
17 unsigned long y;
18 unsigned long u_regs[16];
19 };
20
21 #define UREG_G0 0
22 #define UREG_G1 1
23 #define UREG_G2 2
24 #define UREG_G3 3
25 #define UREG_G4 4
26 #define UREG_G5 5
27 #define UREG_G6 6
28 #define UREG_G7 7
29 #define UREG_I0 8
30 #define UREG_I1 9
31 #define UREG_I2 10
32 #define UREG_I3 11
33 #define UREG_I4 12
34 #define UREG_I5 13
35 #define UREG_I6 14
36 #define UREG_I7 15
37 #define UREG_WIM UREG_G0
38 #define UREG_FADDR UREG_G0
39 #define UREG_FP UREG_I6
40 #define UREG_RETPC UREG_I7
41
42
43 struct reg_window {
44 unsigned long locals[8];
45 unsigned long ins[8];
46 };
47
48
49
50 struct sparc_stackf {
51 unsigned long locals[8];
52 unsigned long ins[6];
53 struct sparc_stackf *fp;
54 unsigned long callers_pc;
55 char *structptr;
56 unsigned long xargs[6];
57 unsigned long xxargs[1];
58 };
59
60 #define TRACEREG_SZ sizeof(struct pt_regs)
61 #define STACKFRAME_SZ sizeof(struct sparc_stackf)
62 #define REGWIN_SZ sizeof(struct reg_window)
63
64 #ifdef __KERNEL__
65 #define user_mode(regs) (!((regs)->psr & PSR_PS))
66 #define instruction_pointer(regs) ((regs)->pc)
67 extern void show_regs(struct pt_regs *);
68 #endif
69
70 #else
71
72 #define TRACEREG_SZ 0x50
73 #define STACKFRAME_SZ 0x60
74 #define REGWIN_SZ 0x40
75 #endif
76
77
78 #define TASK_STATE 0x000
79 #define TASK_PRIORITY 0x008
80 #define TASK_SIGNAL 0x00c
81 #define TASK_BLOCKED 0x010
82 #define TASK_FLAGS 0x014
83 #define TASK_SAVED_KSTACK 0x054
84 #define TASK_KSTACK_PG 0x058
85
86
87 #define THREAD_UMASK 0x210
88 #define THREAD_SADDR 0x218
89 #define THREAD_SDESC 0x21c
90 #define THREAD_KSP 0x220
91 #define THREAD_KPC 0x224
92 #define THREAD_KPSR 0x228
93 #define THREAD_KWIM 0x22c
94 #define THREAD_FORK_KPSR 0x230
95 #define THREAD_FORK_KWIM 0x234
96 #define THREAD_REG_WINDOW 0x238
97 #define THREAD_STACK_PTRS 0x438
98 #define THREAD_W_SAVED 0x458
99 #define THREAD_FLOAT_REGS 0x460
100 #define THREAD_FSR 0x560
101 #define THREAD_SIGSTK 0x5e8
102 #define THREAD_MM 0x620
103 #define THREAD_MM_CTX 0x008
104
105
106 #define PT_PSR 0x0
107 #define PT_PC 0x4
108 #define PT_NPC 0x8
109 #define PT_Y 0xc
110 #define PT_G0 0x10
111 #define PT_WIM PT_G0
112 #define PT_G1 0x14
113 #define PT_G2 0x18
114 #define PT_G3 0x1c
115 #define PT_G4 0x20
116 #define PT_G5 0x24
117 #define PT_G6 0x28
118 #define PT_G7 0x2c
119 #define PT_I0 0x30
120 #define PT_I1 0x34
121 #define PT_I2 0x38
122 #define PT_I3 0x3c
123 #define PT_I4 0x40
124 #define PT_I5 0x44
125 #define PT_I6 0x48
126 #define PT_FP PT_I6
127 #define PT_I7 0x4c
128
129
130 #define RW_L0 0x00
131 #define RW_L1 0x04
132 #define RW_L2 0x08
133 #define RW_L3 0x0c
134 #define RW_L4 0x10
135 #define RW_L5 0x14
136 #define RW_L6 0x18
137 #define RW_L7 0x1c
138 #define RW_I0 0x20
139 #define RW_I1 0x24
140 #define RW_I2 0x28
141 #define RW_I3 0x2c
142 #define RW_I4 0x30
143 #define RW_I5 0x34
144 #define RW_I6 0x38
145 #define RW_I7 0x3c
146
147
148 #define SF_L0 0x00
149 #define SF_L1 0x04
150 #define SF_L2 0x08
151 #define SF_L3 0x0c
152 #define SF_L4 0x10
153 #define SF_L5 0x14
154 #define SF_L6 0x18
155 #define SF_L7 0x1c
156 #define SF_I0 0x20
157 #define SF_I1 0x24
158 #define SF_I2 0x28
159 #define SF_I3 0x2c
160 #define SF_I4 0x30
161 #define SF_I5 0x34
162 #define SF_FP 0x38
163 #define SF_PC 0x3c
164 #define SF_RETP 0x40
165 #define SF_XARG0 0x44
166 #define SF_XARG1 0x48
167 #define SF_XARG2 0x4c
168 #define SF_XARG3 0x50
169 #define SF_XARG4 0x54
170 #define SF_XARG5 0x58
171 #define SF_XXARG 0x5c
172
173
174 #if 0
175 #undef PTRACE_ATTACH
176 #undef PTRACE_DETACH
177 #define PTRACE_ATTACH 10
178 #define PTRACE_DETACH 11
179 #endif
180 #define PTRACE_GETREGS 12
181 #define PTRACE_SETREGS 13
182 #define PTRACE_GETFPREGS 14
183 #define PTRACE_SETFPREGS 15
184 #define PTRACE_READDATA 16
185 #define PTRACE_WRITEDATA 17
186 #define PTRACE_READTEXT 18
187 #define PTRACE_WRITETEXT 19
188 #define PTRACE_GETFPAREGS 20
189 #define PTRACE_SETFPAREGS 21
190
191 #define PTRACE_GETUCODE 29
192
193
194 #endif