1 /* Header file for unwinding stack frames for exception handling. */
2 /* Compile this one with gcc. */
3 /* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
4 Contributed by Jason Merrill <jason@cygnus.com>.
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 #ifndef DWARF_FRAME_REGISTERS
25 #define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
28 typedef struct frame_state
34 long reg_or_offset
[DWARF_FRAME_REGISTERS
+1];
35 unsigned short cfa_reg
;
36 unsigned short retaddr_column
;
37 char saved
[DWARF_FRAME_REGISTERS
+1];
40 /* Values for 'saved' above. */
42 #define REG_SAVED_OFFSET 1
43 #define REG_SAVED_REG 2
45 /* The representation for an "object" to be searched for frame unwind info.
46 For targets with named sections, one object is an executable or shared
47 library; for other targets, one object is one translation unit.
49 A copy of this structure declaration is printed by collect2.c;
50 keep the copies synchronized! */
53 #ifdef IA64_UNWIND_INFO
54 void *pc_base
; /* This field will be set by find_fde. */
58 struct dwarf_fde
*fde_begin
;
59 #ifdef IA64_UNWIND_INFO
60 struct dwarf_fde
*fde_end
;
62 struct dwarf_fde
**fde_array
;
67 /* Note the following routines are exported interfaces from libgcc; do not
68 change these interfaces. Instead create new interfaces. Also note
69 references to these functions may be made weak in files where they
72 extern void __register_frame (void * );
73 extern void __register_frame_table (void *);
74 extern void __deregister_frame (void *);
76 /* Called either from crtbegin.o or a static constructor to register the
77 unwind info for an object or translation unit, respectively. */
79 extern void __register_frame_info (void *, struct object
*);
81 /* Similar, but BEGIN is actually a pointer to a table of unwind entries
82 for different translation units. Called from the file generated by
84 extern void __register_frame_info_table (void *, struct object
*);
86 /* Called from crtend.o to deregister the unwind info for an object. */
88 extern void *__deregister_frame_info (void *);
90 /* Called from __throw to find the registers to restore for a given
91 PC_TARGET. The caller should allocate a local variable of `struct
92 frame_state' (declared in frame.h) and pass its address to STATE_IN.
93 Returns NULL on failure, otherwise returns STATE_IN. */
95 extern struct frame_state
*__frame_state_for (void *, struct frame_state
*);
97 #ifdef IA64_UNWIND_INFO
99 /* This is the information required for unwind records in an ia64
100 object file. This is required by GAS and the compiler runtime. */
102 /* These are the starting point masks for the various types of
103 unwind records. To create a record of type R3 for instance, one
104 starts by using the value UNW_R3 and or-ing in any other required values.
105 These values are also unique (in context), so they can be used to identify
106 the various record types as well. UNW_Bx and some UNW_Px do have the
107 same value, but Px can only occur in a prologue context, and Bx in
132 /* These are all the various types of unwind records. */
136 prologue
, prologue_gr
, body
, mem_stack_f
, mem_stack_v
, psp_gr
, psp_sprel
,
137 rp_when
, rp_gr
, rp_br
, rp_psprel
, rp_sprel
, pfs_when
, pfs_gr
, pfs_psprel
,
138 pfs_sprel
, preds_when
, preds_gr
, preds_psprel
, preds_sprel
,
139 fr_mem
, frgr_mem
, gr_gr
, gr_mem
, br_mem
, br_gr
, spill_base
, spill_mask
,
140 unat_when
, unat_gr
, unat_psprel
, unat_sprel
, lc_when
, lc_gr
, lc_psprel
,
141 lc_sprel
, fpsr_when
, fpsr_gr
, fpsr_psprel
, fpsr_sprel
,
142 priunat_when_gr
, priunat_when_mem
, priunat_gr
, priunat_psprel
,
143 priunat_sprel
, bsp_when
, bsp_gr
, bsp_psprel
, bsp_sprel
, bspstore_when
,
144 bspstore_gr
, bspstore_psprel
, bspstore_sprel
, rnat_when
, rnat_gr
,
145 rnat_psprel
, rnat_sprel
, epilogue
, label_state
, copy_state
,
146 spill_psprel
, spill_sprel
, spill_reg
, spill_psprel_p
, spill_sprel_p
,
151 /* These structures declare the fields that can be used in each of the
152 4 record formats, R, P, B and X. */
154 typedef struct unw_r_record
158 unsigned short grsave
;
161 typedef struct unw_p_record
168 unsigned long pspoff
;
170 unsigned short rmask
;
171 unsigned short grmask
;
172 unsigned long frmask
;
173 unsigned short brmask
;
176 typedef struct unw_b_record
180 unsigned short ecount
;
183 typedef struct unw_x_record
187 unsigned long pspoff
;
191 unsigned short xy
; /* Value of the XY field.. */
194 /* This structure is used to determine the specific record type and
196 typedef struct unwind_record
198 unw_record_type type
;
207 #define IA64_UNW_LOC_TYPE_NONE 0
208 #define IA64_UNW_LOC_TYPE_MEM 1
209 #define IA64_UNW_LOC_TYPE_GR 2
210 #define IA64_UNW_LOC_TYPE_FR 3
211 #define IA64_UNW_LOC_TYPE_BR 4
212 #define IA64_UNW_LOC_TYPE_SPOFF 5
213 #define IA64_UNW_LOC_TYPE_PSPOFF 6
214 #define IA64_UNW_LOC_TYPE_OFFSET 7
215 #define IA64_UNW_LOC_TYPE_SPILLBASE 8
217 typedef struct ia64_reg_loc
219 long when
; /* PC relative offset from start of function. */
220 union { /* In memory or another register? */
225 short loc_type
; /* Where to find value. */
229 /* Frame information record. */
231 typedef struct ia64_frame_state
233 ia64_reg_loc gr
[4]; /* gr4 to gr7. */
234 ia64_reg_loc fr
[20]; /* fr2 to fr5, fr16 to fr31. */
235 ia64_reg_loc br
[5]; /* br1 to br5. */
239 ia64_reg_loc bspstore
;
245 ia64_reg_loc priunat
;
248 ia64_reg_loc spill_base
;
253 /* This structure represents the start of an unwind information pointer.
254 'unwind_descriptors' is the beginninng of the unwind descriptors, which
255 use up 'length' bytes of storage. */
257 typedef struct unwind_info_ptr
259 unsigned long header
; /* version, flags, & length */
260 unsigned char unwind_descriptors
[1];
263 #define IA64_UNW_HDR_LENGTH(x) ((x) & 0x00000000ffffffffUL)
264 #define IA64_UNW_HDR_FLAGS(x) (((x) >> 32) & 0xffffUL)
265 #define IA64_UNW_HDR_VERSION(x) (((x) >> 48) & 0xffffUL)
267 extern unwind_info_ptr
*__build_ia64_frame_state (unsigned char *,
268 ia64_frame_state
*, void *,
270 extern void *__get_real_reg_value (ia64_reg_loc
*);
271 extern void *__get_personality (unwind_info_ptr
*);
272 extern void *__get_except_table (unwind_info_ptr
*);
273 extern void __set_real_reg_value (ia64_reg_loc
*, void *);
274 void *__calc_caller_bsp (long, unsigned char *);
275 void __copy_saved_reg_state (ia64_frame_state
*, ia64_frame_state
*);
276 #endif /* IA64_UNWIND_INFO */