1#ifndef _ASM_IA64_UNWIND_H
2#define _ASM_IA64_UNWIND_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16struct task_struct;
17struct switch_stack;
18
19enum unw_application_register {
20 UNW_AR_BSP,
21 UNW_AR_BSPSTORE,
22 UNW_AR_PFS,
23 UNW_AR_RNAT,
24 UNW_AR_UNAT,
25 UNW_AR_LC,
26 UNW_AR_EC,
27 UNW_AR_FPSR,
28 UNW_AR_RSC,
29 UNW_AR_CCV
30};
31
32
33
34
35
36
37struct unw_stack {
38 unsigned long limit;
39 unsigned long top;
40};
41
42#define UNW_FLAG_INTERRUPT_FRAME (1UL << 0)
43
44
45
46
47
48
49struct unw_frame_info {
50 struct unw_stack regstk;
51 struct unw_stack memstk;
52 unsigned int flags;
53 short hint;
54 short prev_script;
55
56
57 unsigned long bsp;
58 unsigned long sp;
59 unsigned long psp;
60 unsigned long ip;
61 unsigned long pr;
62 unsigned long *cfm_loc;
63
64 struct task_struct *task;
65 struct switch_stack *sw;
66
67
68 unsigned long *bsp_loc;
69 unsigned long *bspstore_loc;
70 unsigned long *pfs_loc;
71 unsigned long *rnat_loc;
72 unsigned long *rp_loc;
73 unsigned long *pri_unat_loc;
74 unsigned long *unat_loc;
75 unsigned long *pr_loc;
76 unsigned long *lc_loc;
77 unsigned long *fpsr_loc;
78 struct unw_ireg {
79 unsigned long *loc;
80 struct unw_ireg_nat {
81 long type : 3;
82 signed long off : 61;
83 } nat;
84 } r4, r5, r6, r7;
85 unsigned long *b1_loc, *b2_loc, *b3_loc, *b4_loc, *b5_loc;
86 struct ia64_fpreg *f2_loc, *f3_loc, *f4_loc, *f5_loc, *fr_loc[16];
87};
88
89
90
91
92
93
94
95
96extern void unw_init (void);
97extern void unw_create_gate_table (void);
98
99extern void *unw_add_unwind_table (const char *name, unsigned long segment_base, unsigned long gp,
100 const void *table_start, const void *table_end);
101
102extern void unw_remove_unwind_table (void *handle);
103
104
105
106
107extern void unw_init_from_blocked_task (struct unw_frame_info *info, struct task_struct *t);
108
109extern void unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t,
110 struct switch_stack *sw);
111
112
113
114
115extern void unw_init_running (void (*callback)(struct unw_frame_info *info, void *arg), void *arg);
116
117
118
119
120
121extern int unw_unwind (struct unw_frame_info *info);
122
123
124
125
126
127
128extern int unw_unwind_to_user (struct unw_frame_info *info);
129
130#define unw_is_intr_frame(info) (((info)->flags & UNW_FLAG_INTERRUPT_FRAME) != 0)
131
132static inline int
133unw_get_ip (struct unw_frame_info *info, unsigned long *valp)
134{
135 *valp = (info)->ip;
136 return 0;
137}
138
139static inline int
140unw_get_sp (struct unw_frame_info *info, unsigned long *valp)
141{
142 *valp = (info)->sp;
143 return 0;
144}
145
146static inline int
147unw_get_psp (struct unw_frame_info *info, unsigned long *valp)
148{
149 *valp = (info)->psp;
150 return 0;
151}
152
153static inline int
154unw_get_bsp (struct unw_frame_info *info, unsigned long *valp)
155{
156 *valp = (info)->bsp;
157 return 0;
158}
159
160static inline int
161unw_get_cfm (struct unw_frame_info *info, unsigned long *valp)
162{
163 *valp = *(info)->cfm_loc;
164 return 0;
165}
166
167static inline int
168unw_set_cfm (struct unw_frame_info *info, unsigned long val)
169{
170 *(info)->cfm_loc = val;
171 return 0;
172}
173
174static inline int
175unw_get_rp (struct unw_frame_info *info, unsigned long *val)
176{
177 if (!info->rp_loc)
178 return -1;
179 *val = *info->rp_loc;
180 return 0;
181}
182
183extern int unw_access_gr (struct unw_frame_info *, int, unsigned long *, char *, int);
184extern int unw_access_br (struct unw_frame_info *, int, unsigned long *, int);
185extern int unw_access_fr (struct unw_frame_info *, int, struct ia64_fpreg *, int);
186extern int unw_access_ar (struct unw_frame_info *, int, unsigned long *, int);
187extern int unw_access_pr (struct unw_frame_info *, unsigned long *, int);
188
189static inline int
190unw_set_gr (struct unw_frame_info *i, int n, unsigned long v, char nat)
191{
192 return unw_access_gr(i, n, &v, &nat, 1);
193}
194
195static inline int
196unw_set_br (struct unw_frame_info *i, int n, unsigned long v)
197{
198 return unw_access_br(i, n, &v, 1);
199}
200
201static inline int
202unw_set_fr (struct unw_frame_info *i, int n, struct ia64_fpreg v)
203{
204 return unw_access_fr(i, n, &v, 1);
205}
206
207static inline int
208unw_set_ar (struct unw_frame_info *i, int n, unsigned long v)
209{
210 return unw_access_ar(i, n, &v, 1);
211}
212
213static inline int
214unw_set_pr (struct unw_frame_info *i, unsigned long v)
215{
216 return unw_access_pr(i, &v, 1);
217}
218
219#define unw_get_gr(i,n,v,nat) unw_access_gr(i,n,v,nat,0)
220#define unw_get_br(i,n,v) unw_access_br(i,n,v,0)
221#define unw_get_fr(i,n,v) unw_access_fr(i,n,v,0)
222#define unw_get_ar(i,n,v) unw_access_ar(i,n,v,0)
223#define unw_get_pr(i,v) unw_access_pr(i,v,0)
224
225#endif
226