~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-ia64/unwind.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ASM_IA64_UNWIND_H
  2 #define _ASM_IA64_UNWIND_H
  3 
  4 /*
  5  * Copyright (C) 1999-2000 Hewlett-Packard Co
  6  * Copyright (C) 1999-2000 David Mosberger-Tang <davidm@hpl.hp.com>
  7  *
  8  * A simple API for unwinding kernel stacks.  This is used for
  9  * debugging and error reporting purposes.  The kernel doesn't need
 10  * full-blown stack unwinding with all the bells and whitles, so there
 11  * is not much point in implementing the full IA-64 unwind API (though
 12  * it would of course be possible to implement the kernel API on top
 13  * of it).
 14  */
 15 
 16 struct task_struct;     /* forward declaration */
 17 struct switch_stack;    /* forward declaration */
 18 
 19 enum 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  * The following declarations are private to the unwind
 34  * implementation:
 35  */
 36 
 37 struct unw_stack {
 38         unsigned long limit;
 39         unsigned long top;
 40 };
 41 
 42 #define UNW_FLAG_INTERRUPT_FRAME        (1UL << 0)
 43 
 44 /*
 45  * No user of this module should every access this structure directly
 46  * as it is subject to change.  It is declared here solely so we can
 47  * use automatic variables.
 48  */
 49 struct 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         /* current frame info: */
 57         unsigned long bsp;              /* backing store pointer value */
 58         unsigned long sp;               /* stack pointer value */
 59         unsigned long psp;              /* previous sp value */
 60         unsigned long ip;               /* instruction pointer value */
 61         unsigned long pr;               /* current predicate values */
 62         unsigned long *cfm_loc;         /* cfm save location (or NULL) */
 63 
 64         struct task_struct *task;
 65         struct switch_stack *sw;
 66 
 67         /* preserved state: */
 68         unsigned long *bsp_loc;         /* previous bsp save location */
 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;                  /* enum unw_nat_type */
 82                         signed long off : 61;           /* NaT word is at loc+nat.off */
 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  * The official API follows below:
 91  */
 92 
 93 /*
 94  * Initialize unwind support.
 95  */
 96 extern void unw_init (void);
 97 
 98 extern void *unw_add_unwind_table (const char *name, unsigned long segment_base, unsigned long gp,
 99                                    void *table_start, void *table_end);
100 
101 extern void unw_remove_unwind_table (void *handle);
102 
103 /*
104  * Prepare to unwind blocked task t.
105  */
106 extern void unw_init_from_blocked_task (struct unw_frame_info *info, struct task_struct *t);
107 
108 extern void unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t,
109                                  struct switch_stack *sw);
110 
111 /*
112  * Prepare to unwind the current task.  For this to work, the kernel
113  * stack identified by REGS must look like this:
114  *
115  *      //                    //
116  *      |                     |
117  *      |   kernel stack      |
118  *      |                     |
119  *      +=====================+
120  *      |   struct pt_regs    |
121  *      +---------------------+ <--- REGS
122  *      | struct switch_stack |
123  *      +---------------------+
124  */
125 extern void unw_init_from_current (struct unw_frame_info *info, struct pt_regs *regs);
126 
127 /*
128  * Prepare to unwind the currently running thread.
129  */
130 extern void unw_init_running (void (*callback)(struct unw_frame_info *info, void *arg), void *arg);
131 
132 /*
133  * Unwind to previous to frame.  Returns 0 if successful, negative
134  * number in case of an error.
135  */
136 extern int unw_unwind (struct unw_frame_info *info);
137 
138 /*
139  * Unwind until the return pointer is in user-land (or until an error
140  * occurs).  Returns 0 if successful, negative number in case of
141  * error.
142  */
143 extern int unw_unwind_to_user (struct unw_frame_info *info);
144 
145 #define unw_is_intr_frame(info) (((info)->flags & UNW_FLAG_INTERRUPT_FRAME) != 0)
146 
147 static inline unsigned long
148 unw_get_ip (struct unw_frame_info *info, unsigned long *valp)
149 {
150         *valp = (info)->ip;
151         return 0;
152 }
153 
154 static inline unsigned long
155 unw_get_sp (struct unw_frame_info *info, unsigned long *valp)
156 {
157         *valp = (info)->sp;
158         return 0;
159 }
160 
161 static inline unsigned long
162 unw_get_psp (struct unw_frame_info *info, unsigned long *valp)
163 {
164         *valp = (info)->psp;
165         return 0;
166 }
167 
168 static inline unsigned long
169 unw_get_bsp (struct unw_frame_info *info, unsigned long *valp)
170 {
171         *valp = (info)->bsp;
172         return 0;
173 }
174 
175 static inline unsigned long
176 unw_get_cfm (struct unw_frame_info *info, unsigned long *valp)
177 {
178         *valp = *(info)->cfm_loc;
179         return 0;
180 }
181 
182 static inline unsigned long
183 unw_set_cfm (struct unw_frame_info *info, unsigned long val)
184 {
185         *(info)->cfm_loc = val;
186         return 0;
187 }
188 
189 static inline int
190 unw_get_rp (struct unw_frame_info *info, unsigned long *val)
191 {
192         if (!info->rp_loc)
193                 return -1;
194         *val = *info->rp_loc;
195         return 0;
196 }
197 
198 extern int unw_access_gr (struct unw_frame_info *, int, unsigned long *, char *, int);
199 extern int unw_access_br (struct unw_frame_info *, int, unsigned long *, int);
200 extern int unw_access_fr (struct unw_frame_info *, int, struct ia64_fpreg *, int);
201 extern int unw_access_ar (struct unw_frame_info *, int, unsigned long *, int);
202 extern int unw_access_pr (struct unw_frame_info *, unsigned long *, int);
203 
204 static inline int
205 unw_set_gr (struct unw_frame_info *i, int n, unsigned long v, char nat)
206 {
207         return unw_access_gr(i, n, &v, &nat, 1);
208 }
209 
210 static inline int
211 unw_set_br (struct unw_frame_info *i, int n, unsigned long v)
212 {
213         return unw_access_br(i, n, &v, 1);
214 }
215 
216 static inline int
217 unw_set_fr (struct unw_frame_info *i, int n, struct ia64_fpreg v)
218 {
219         return unw_access_fr(i, n, &v, 1);
220 }
221 
222 static inline int
223 unw_set_ar (struct unw_frame_info *i, int n, unsigned long v)
224 {
225         return unw_access_ar(i, n, &v, 1);
226 }
227 
228 static inline int
229 unw_set_pr (struct unw_frame_info *i, unsigned long v)
230 {
231         return unw_access_pr(i, &v, 1);
232 }
233 
234 #define unw_get_gr(i,n,v,nat)   unw_access_gr(i,n,v,nat,0)
235 #define unw_get_br(i,n,v)       unw_access_br(i,n,v,0)
236 #define unw_get_fr(i,n,v)       unw_access_fr(i,n,v,0)
237 #define unw_get_ar(i,n,v)       unw_access_ar(i,n,v,0)
238 #define unw_get_pr(i,v)         unw_access_pr(i,v,0)
239 
240 #endif /* _ASM_UNWIND_H */
241 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.