1 #ifndef _ASM_IA64_PTRACE_H
2 #define _ASM_IA64_PTRACE_H
3
4 /*
5 * Copyright (C) 1998-2000 Hewlett-Packard Co
6 * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com>
7 * Copyright (C) 1998, 1999 Stephane Eranian <eranian@hpl.hp.com>
8 *
9 * 12/07/98 S. Eranian added pt_regs & switch_stack
10 * 12/21/98 D. Mosberger updated to match latest code
11 * 6/17/99 D. Mosberger added second unat member to "struct switch_stack"
12 *
13 */
14 /*
15 * When a user process is blocked, its state looks as follows:
16 *
17 * +----------------------+ ------- IA64_STK_OFFSET
18 * | | ^
19 * | struct pt_regs | |
20 * | | |
21 * +----------------------+ |
22 * | | |
23 * | memory stack | |
24 * | (growing downwards) | |
25 * //.....................// |
26 * |
27 * //.....................// |
28 * | | |
29 * +----------------------+ |
30 * | struct switch_stack | |
31 * | | |
32 * +----------------------+ |
33 * | | |
34 * //.....................// |
35 * |
36 * //.....................// |
37 * | | |
38 * | register stack | |
39 * | (growing upwards) | |
40 * | | |
41 * +----------------------+ | --- IA64_RBS_OFFSET
42 * | | | ^
43 * | struct task_struct | | |
44 * current -> | | | |
45 * +----------------------+ -------
46 *
47 * Note that ar.ec is not saved explicitly in pt_reg or switch_stack.
48 * This is because ar.ec is saved as part of ar.pfs.
49 */
50
51 #include <linux/config.h>
52
53 #include <asm/fpu.h>
54 #include <asm/offsets.h>
55
56 /*
57 * Base-2 logarithm of number of pages to allocate per task structure
58 * (including register backing store and memory stack):
59 */
60 #if defined(CONFIG_IA64_PAGE_SIZE_4KB)
61 # define IA64_TASK_STRUCT_LOG_NUM_PAGES 3
62 #elif defined(CONFIG_IA64_PAGE_SIZE_8KB)
63 # define IA64_TASK_STRUCT_LOG_NUM_PAGES 2
64 #elif defined(CONFIG_IA64_PAGE_SIZE_16KB)
65 # define IA64_TASK_STRUCT_LOG_NUM_PAGES 1
66 #else
67 # define IA64_TASK_STRUCT_LOG_NUM_PAGES 0
68 #endif
69
70 #define IA64_RBS_OFFSET ((IA64_TASK_SIZE + 15) & ~15)
71 #define IA64_STK_OFFSET ((1 << IA64_TASK_STRUCT_LOG_NUM_PAGES)*PAGE_SIZE)
72
73 #define INIT_TASK_SIZE IA64_STK_OFFSET
74
75 #ifndef __ASSEMBLY__
76
77 #include <asm/current.h>
78 #include <asm/page.h>
79
80 /*
81 * This struct defines the way the registers are saved on system
82 * calls.
83 *
84 * We don't save all floating point register because the kernel
85 * is compiled to use only a very small subset, so the other are
86 * untouched.
87 *
88 * THIS STRUCTURE MUST BE A MULTIPLE 16-BYTE IN SIZE
89 * (because the memory stack pointer MUST ALWAYS be aligned this way)
90 *
91 */
92 struct pt_regs {
93 /* The following registers are saved by SAVE_MIN: */
94
95 unsigned long cr_ipsr; /* interrupted task's psr */
96 unsigned long cr_iip; /* interrupted task's instruction pointer */
97 unsigned long cr_ifs; /* interrupted task's function state */
98
99 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
100 unsigned long ar_pfs; /* prev function state */
101 unsigned long ar_rsc; /* RSE configuration */
102 /* The following two are valid only if cr_ipsr.cpl > 0: */
103 unsigned long ar_rnat; /* RSE NaT */
104 unsigned long ar_bspstore; /* RSE bspstore */
105
106 unsigned long pr; /* 64 predicate registers (1 bit each) */
107 unsigned long b6; /* scratch */
108 unsigned long loadrs; /* size of dirty partition << 16 */
109
110 unsigned long r1; /* the gp pointer */
111 unsigned long r2; /* scratch */
112 unsigned long r3; /* scratch */
113 unsigned long r12; /* interrupted task's memory stack pointer */
114 unsigned long r13; /* thread pointer */
115 unsigned long r14; /* scratch */
116 unsigned long r15; /* scratch */
117
118 unsigned long r8; /* scratch (return value register 0) */
119 unsigned long r9; /* scratch (return value register 1) */
120 unsigned long r10; /* scratch (return value register 2) */
121 unsigned long r11; /* scratch (return value register 3) */
122
123 /* The following registers are saved by SAVE_REST: */
124
125 unsigned long r16; /* scratch */
126 unsigned long r17; /* scratch */
127 unsigned long r18; /* scratch */
128 unsigned long r19; /* scratch */
129 unsigned long r20; /* scratch */
130 unsigned long r21; /* scratch */
131 unsigned long r22; /* scratch */
132 unsigned long r23; /* scratch */
133 unsigned long r24; /* scratch */
134 unsigned long r25; /* scratch */
135 unsigned long r26; /* scratch */
136 unsigned long r27; /* scratch */
137 unsigned long r28; /* scratch */
138 unsigned long r29; /* scratch */
139 unsigned long r30; /* scratch */
140 unsigned long r31; /* scratch */
141
142 unsigned long ar_ccv; /* compare/exchange value (scratch) */
143 unsigned long ar_fpsr; /* floating point status (preserved) */
144
145 unsigned long b0; /* return pointer (bp) */
146 unsigned long b7; /* scratch */
147 /*
148 * Floating point registers that the kernel considers
149 * scratch:
150 */
151 struct ia64_fpreg f6; /* scratch */
152 struct ia64_fpreg f7; /* scratch */
153 struct ia64_fpreg f8; /* scratch */
154 struct ia64_fpreg f9; /* scratch */
155 };
156
157 /*
158 * This structure contains the addition registers that need to
159 * preserved across a context switch. This generally consists of
160 * "preserved" registers.
161 */
162 struct switch_stack {
163 unsigned long caller_unat; /* user NaT collection register (preserved) */
164 unsigned long ar_fpsr; /* floating-point status register */
165
166 struct ia64_fpreg f2; /* preserved */
167 struct ia64_fpreg f3; /* preserved */
168 struct ia64_fpreg f4; /* preserved */
169 struct ia64_fpreg f5; /* preserved */
170
171 struct ia64_fpreg f10; /* scratch, but untouched by kernel */
172 struct ia64_fpreg f11; /* scratch, but untouched by kernel */
173 struct ia64_fpreg f12; /* scratch, but untouched by kernel */
174 struct ia64_fpreg f13; /* scratch, but untouched by kernel */
175 struct ia64_fpreg f14; /* scratch, but untouched by kernel */
176 struct ia64_fpreg f15; /* scratch, but untouched by kernel */
177 struct ia64_fpreg f16; /* preserved */
178 struct ia64_fpreg f17; /* preserved */
179 struct ia64_fpreg f18; /* preserved */
180 struct ia64_fpreg f19; /* preserved */
181 struct ia64_fpreg f20; /* preserved */
182 struct ia64_fpreg f21; /* preserved */
183 struct ia64_fpreg f22; /* preserved */
184 struct ia64_fpreg f23; /* preserved */
185 struct ia64_fpreg f24; /* preserved */
186 struct ia64_fpreg f25; /* preserved */
187 struct ia64_fpreg f26; /* preserved */
188 struct ia64_fpreg f27; /* preserved */
189 struct ia64_fpreg f28; /* preserved */
190 struct ia64_fpreg f29; /* preserved */
191 struct ia64_fpreg f30; /* preserved */
192 struct ia64_fpreg f31; /* preserved */
193
194 unsigned long r4; /* preserved */
195 unsigned long r5; /* preserved */
196 unsigned long r6; /* preserved */
197 unsigned long r7; /* preserved */
198
199 unsigned long b0; /* so we can force a direct return in copy_thread */
200 unsigned long b1;
201 unsigned long b2;
202 unsigned long b3;
203 unsigned long b4;
204 unsigned long b5;
205
206 unsigned long ar_pfs; /* previous function state */
207 unsigned long ar_lc; /* loop counter (preserved) */
208 unsigned long ar_unat; /* NaT bits for r4-r7 */
209 unsigned long ar_rnat; /* RSE NaT collection register */
210 unsigned long ar_bspstore; /* RSE dirty base (preserved) */
211 unsigned long pr; /* 64 predicate registers (1 bit each) */
212 };
213
214 #ifdef __KERNEL__
215 /* given a pointer to a task_struct, return the user's pt_regs */
216 # define ia64_task_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
217 # define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr)
218 # define user_mode(regs) (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0)
219
220 struct task_struct; /* forward decl */
221
222 extern void show_regs (struct pt_regs *);
223 extern long ia64_peek (struct pt_regs *, struct task_struct *, unsigned long addr, long *val);
224 extern long ia64_poke (struct pt_regs *, struct task_struct *, unsigned long addr, long val);
225 extern void ia64_flush_fph (struct task_struct *t);
226 extern void ia64_sync_fph (struct task_struct *t);
227
228 #ifdef CONFIG_IA64_NEW_UNWIND
229 /* get nat bits for scratch registers such that bit N==1 iff scratch register rN is a NaT */
230 extern unsigned long ia64_get_scratch_nat_bits (struct pt_regs *pt, unsigned long scratch_unat);
231 /* put nat bits for scratch registers such that scratch register rN is a NaT iff bit N==1 */
232 extern unsigned long ia64_put_scratch_nat_bits (struct pt_regs *pt, unsigned long nat);
233 #else
234 /* get nat bits for r1-r31 such that bit N==1 iff rN is a NaT */
235 extern long ia64_get_nat_bits (struct pt_regs *pt, struct switch_stack *sw);
236 /* put nat bits for r1-r31 such that rN is a NaT iff bit N==1 */
237 extern void ia64_put_nat_bits (struct pt_regs *pt, struct switch_stack *sw, unsigned long nat);
238 #endif
239
240 extern void ia64_increment_ip (struct pt_regs *pt);
241 extern void ia64_decrement_ip (struct pt_regs *pt);
242
243 static inline void
244 force_successful_syscall_return (void)
245 {
246 ia64_task_regs(current)->r8 = 0;
247 }
248
249 #endif /* !__KERNEL__ */
250
251 #endif /* !__ASSEMBLY__ */
252
253 /*
254 * The numbers chosen here are somewhat arbitrary but absolutely MUST
255 * not overlap with any of the number assigned in <linux/ptrace.h>.
256 */
257 #define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
258 #define PTRACE_GETSIGINFO 13 /* get child's siginfo structure */
259 #define PTRACE_SETSIGINFO 14 /* set child's siginfo structure */
260
261 #endif /* _ASM_IA64_PTRACE_H */
262
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.