1#ifndef _ASM_IA64_PTRACE_H
2#define _ASM_IA64_PTRACE_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58#include <asm/fpu.h>
59
60#ifdef __KERNEL__
61#ifndef ASM_OFFSETS_C
62#include <asm/asm-offsets.h>
63#endif
64
65
66
67
68
69#if defined(CONFIG_IA64_PAGE_SIZE_4KB)
70# define KERNEL_STACK_SIZE_ORDER 3
71#elif defined(CONFIG_IA64_PAGE_SIZE_8KB)
72# define KERNEL_STACK_SIZE_ORDER 2
73#elif defined(CONFIG_IA64_PAGE_SIZE_16KB)
74# define KERNEL_STACK_SIZE_ORDER 1
75#else
76# define KERNEL_STACK_SIZE_ORDER 0
77#endif
78
79#define IA64_RBS_OFFSET ((IA64_TASK_SIZE + IA64_THREAD_INFO_SIZE + 31) & ~31)
80#define IA64_STK_OFFSET ((1 << KERNEL_STACK_SIZE_ORDER)*PAGE_SIZE)
81
82#define KERNEL_STACK_SIZE IA64_STK_OFFSET
83
84#endif
85
86#ifndef __ASSEMBLY__
87
88
89
90
91
92
93
94
95
96
97
98
99
100struct pt_regs {
101
102 unsigned long b6;
103 unsigned long b7;
104
105 unsigned long ar_csd;
106 unsigned long ar_ssd;
107
108 unsigned long r8;
109 unsigned long r9;
110 unsigned long r10;
111 unsigned long r11;
112
113 unsigned long cr_ipsr;
114 unsigned long cr_iip;
115
116
117
118
119 unsigned long cr_ifs;
120
121 unsigned long ar_unat;
122 unsigned long ar_pfs;
123 unsigned long ar_rsc;
124
125 unsigned long ar_rnat;
126 unsigned long ar_bspstore;
127
128 unsigned long pr;
129 unsigned long b0;
130 unsigned long loadrs;
131
132 unsigned long r1;
133 unsigned long r12;
134 unsigned long r13;
135
136 unsigned long ar_fpsr;
137 unsigned long r15;
138
139
140
141 unsigned long r14;
142 unsigned long r2;
143 unsigned long r3;
144
145
146 unsigned long r16;
147 unsigned long r17;
148 unsigned long r18;
149 unsigned long r19;
150 unsigned long r20;
151 unsigned long r21;
152 unsigned long r22;
153 unsigned long r23;
154 unsigned long r24;
155 unsigned long r25;
156 unsigned long r26;
157 unsigned long r27;
158 unsigned long r28;
159 unsigned long r29;
160 unsigned long r30;
161 unsigned long r31;
162
163 unsigned long ar_ccv;
164
165
166
167
168 struct ia64_fpreg f6;
169 struct ia64_fpreg f7;
170 struct ia64_fpreg f8;
171 struct ia64_fpreg f9;
172 struct ia64_fpreg f10;
173 struct ia64_fpreg f11;
174};
175
176
177
178
179
180
181struct switch_stack {
182 unsigned long caller_unat;
183 unsigned long ar_fpsr;
184
185 struct ia64_fpreg f2;
186 struct ia64_fpreg f3;
187 struct ia64_fpreg f4;
188 struct ia64_fpreg f5;
189
190 struct ia64_fpreg f12;
191 struct ia64_fpreg f13;
192 struct ia64_fpreg f14;
193 struct ia64_fpreg f15;
194 struct ia64_fpreg f16;
195 struct ia64_fpreg f17;
196 struct ia64_fpreg f18;
197 struct ia64_fpreg f19;
198 struct ia64_fpreg f20;
199 struct ia64_fpreg f21;
200 struct ia64_fpreg f22;
201 struct ia64_fpreg f23;
202 struct ia64_fpreg f24;
203 struct ia64_fpreg f25;
204 struct ia64_fpreg f26;
205 struct ia64_fpreg f27;
206 struct ia64_fpreg f28;
207 struct ia64_fpreg f29;
208 struct ia64_fpreg f30;
209 struct ia64_fpreg f31;
210
211 unsigned long r4;
212 unsigned long r5;
213 unsigned long r6;
214 unsigned long r7;
215
216 unsigned long b0;
217 unsigned long b1;
218 unsigned long b2;
219 unsigned long b3;
220 unsigned long b4;
221 unsigned long b5;
222
223 unsigned long ar_pfs;
224 unsigned long ar_lc;
225 unsigned long ar_unat;
226 unsigned long ar_rnat;
227 unsigned long ar_bspstore;
228 unsigned long pr;
229};
230
231#ifdef __KERNEL__
232
233#include <asm/current.h>
234#include <asm/page.h>
235
236
237
238
239
240
241# define instruction_pointer(regs) ((regs)->cr_iip + ia64_psr(regs)->ri)
242
243static inline unsigned long user_stack_pointer(struct pt_regs *regs)
244{
245
246 return regs->ar_bspstore;
247}
248
249static inline int is_syscall_success(struct pt_regs *regs)
250{
251 return regs->r10 != -1;
252}
253
254static inline long regs_return_value(struct pt_regs *regs)
255{
256 if (is_syscall_success(regs))
257 return regs->r8;
258 else
259 return -regs->r8;
260}
261
262
263
264
265#define profile_pc(regs) \
266({ \
267 unsigned long __ip = instruction_pointer(regs); \
268 (__ip & ~3UL) + ((__ip & 3UL) << 2); \
269})
270
271
272# define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
273# define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr)
274# define user_mode(regs) (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0)
275# define user_stack(task,regs) ((long) regs - (long) task == IA64_STK_OFFSET - sizeof(*regs))
276# define fsys_mode(task,regs) \
277 ({ \
278 struct task_struct *_task = (task); \
279 struct pt_regs *_regs = (regs); \
280 !user_mode(_regs) && user_stack(_task, _regs); \
281 })
282
283
284
285
286
287
288
289
290
291
292
293
294
295# define force_successful_syscall_return() (task_pt_regs(current)->r8 = 0)
296
297 struct task_struct;
298 struct unw_frame_info;
299
300 extern void ia64_do_show_stack (struct unw_frame_info *, void *);
301 extern unsigned long ia64_get_user_rbs_end (struct task_struct *, struct pt_regs *,
302 unsigned long *);
303 extern long ia64_peek (struct task_struct *, struct switch_stack *, unsigned long,
304 unsigned long, long *);
305 extern long ia64_poke (struct task_struct *, struct switch_stack *, unsigned long,
306 unsigned long, long);
307 extern void ia64_flush_fph (struct task_struct *);
308 extern void ia64_sync_fph (struct task_struct *);
309 extern void ia64_sync_krbs(void);
310 extern long ia64_sync_user_rbs (struct task_struct *, struct switch_stack *,
311 unsigned long, unsigned long);
312
313
314 extern unsigned long ia64_get_scratch_nat_bits (struct pt_regs *pt, unsigned long scratch_unat);
315
316 extern unsigned long ia64_put_scratch_nat_bits (struct pt_regs *pt, unsigned long nat);
317
318 extern void ia64_increment_ip (struct pt_regs *pt);
319 extern void ia64_decrement_ip (struct pt_regs *pt);
320
321 extern void ia64_ptrace_stop(void);
322 #define arch_ptrace_stop(code, info) \
323 ia64_ptrace_stop()
324 #define arch_ptrace_stop_needed(code, info) \
325 (!test_thread_flag(TIF_RESTORE_RSE))
326
327 extern void ptrace_attach_sync_user_rbs (struct task_struct *);
328 #define arch_ptrace_attach(child) \
329 ptrace_attach_sync_user_rbs(child)
330
331 #define arch_has_single_step() (1)
332 #define arch_has_block_step() (1)
333
334#endif
335
336
337struct pt_all_user_regs {
338 unsigned long nat;
339 unsigned long cr_iip;
340 unsigned long cfm;
341 unsigned long cr_ipsr;
342 unsigned long pr;
343
344 unsigned long gr[32];
345 unsigned long br[8];
346 unsigned long ar[128];
347 struct ia64_fpreg fr[128];
348};
349
350#endif
351
352
353#define PT_AUR_RSC 16
354#define PT_AUR_BSP 17
355#define PT_AUR_BSPSTORE 18
356#define PT_AUR_RNAT 19
357#define PT_AUR_CCV 32
358#define PT_AUR_UNAT 36
359#define PT_AUR_FPSR 40
360#define PT_AUR_PFS 64
361#define PT_AUR_LC 65
362#define PT_AUR_EC 66
363
364
365
366
367
368#define PTRACE_SINGLEBLOCK 12
369#define PTRACE_OLD_GETSIGINFO 13
370#define PTRACE_OLD_SETSIGINFO 14
371#define PTRACE_GETREGS 18
372#define PTRACE_SETREGS 19
373
374#define PTRACE_OLDSETOPTIONS 21
375
376#endif
377