]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ginclude/unwind-arm-common.h
configure.ac: Don't add ${libgcj} for arm*-*-freebsd*.
[thirdparty/gcc.git] / gcc / ginclude / unwind-arm-common.h
1 /* Header file for the ARM EABI and C6X unwinders
2 Copyright (C) 2003-2015 Free Software Foundation, Inc.
3 Contributed by Paul Brook
4
5 This file is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 3, or (at your option) any
8 later version.
9
10 This file is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
18
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
23
24 /* Language-independent unwinder header public defines. This contains both
25 ABI defined objects, and GNU support routines. */
26
27 #ifndef UNWIND_ARM_COMMON_H
28 #define UNWIND_ARM_COMMON_H
29
30 #define __ARM_EABI_UNWINDER__ 1
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
36 typedef signed _Unwind_Sword __attribute__((__mode__(__word__)));
37 typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
38 typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__)));
39 typedef _Unwind_Word _uw;
40 typedef unsigned _uw64 __attribute__((mode(__DI__)));
41 typedef unsigned _uw16 __attribute__((mode(__HI__)));
42 typedef unsigned _uw8 __attribute__((mode(__QI__)));
43
44 typedef enum
45 {
46 _URC_OK = 0, /* operation completed successfully */
47 _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
48 _URC_END_OF_STACK = 5,
49 _URC_HANDLER_FOUND = 6,
50 _URC_INSTALL_CONTEXT = 7,
51 _URC_CONTINUE_UNWIND = 8,
52 _URC_FAILURE = 9 /* unspecified failure of some kind */
53 }
54 _Unwind_Reason_Code;
55
56 typedef enum
57 {
58 _US_VIRTUAL_UNWIND_FRAME = 0,
59 _US_UNWIND_FRAME_STARTING = 1,
60 _US_UNWIND_FRAME_RESUME = 2,
61 _US_ACTION_MASK = 3,
62 _US_FORCE_UNWIND = 8,
63 _US_END_OF_STACK = 16
64 }
65 _Unwind_State;
66
67 /* Provided only for compatibility with existing code. */
68 typedef int _Unwind_Action;
69 #define _UA_SEARCH_PHASE 1
70 #define _UA_CLEANUP_PHASE 2
71 #define _UA_HANDLER_FRAME 4
72 #define _UA_FORCE_UNWIND 8
73 #define _UA_END_OF_STACK 16
74 #define _URC_NO_REASON _URC_OK
75
76 typedef struct _Unwind_Control_Block _Unwind_Control_Block;
77 typedef struct _Unwind_Context _Unwind_Context;
78 typedef _uw _Unwind_EHT_Header;
79
80
81 /* UCB: */
82
83 struct _Unwind_Control_Block
84 {
85 #ifdef __FreeBSD__
86 unsigned exception_class __attribute__((__mode__(__DI__)));
87 #else
88 char exception_class[8];
89 #endif
90 void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
91 /* Unwinder cache, private fields for the unwinder's use */
92 struct
93 {
94 _uw reserved1; /* Forced unwind stop fn, 0 if not forced */
95 _uw reserved2; /* Personality routine address */
96 _uw reserved3; /* Saved callsite address */
97 _uw reserved4; /* Forced unwind stop arg */
98 _uw reserved5;
99 }
100 unwinder_cache;
101 /* Propagation barrier cache (valid after phase 1): */
102 struct
103 {
104 _uw sp;
105 _uw bitpattern[5];
106 }
107 barrier_cache;
108 /* Cleanup cache (preserved over cleanup): */
109 struct
110 {
111 _uw bitpattern[4];
112 }
113 cleanup_cache;
114 /* Pr cache (for pr's benefit): */
115 struct
116 {
117 _uw fnstart; /* function start address */
118 _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */
119 _uw additional; /* additional data */
120 _uw reserved1;
121 }
122 pr_cache;
123 long long int :0; /* Force alignment to 8-byte boundary */
124 };
125
126 /* Virtual Register Set*/
127
128 typedef enum
129 {
130 _UVRSC_CORE = 0, /* integer register */
131 _UVRSC_VFP = 1, /* vfp */
132 _UVRSC_FPA = 2, /* fpa */
133 _UVRSC_WMMXD = 3, /* Intel WMMX data register */
134 _UVRSC_WMMXC = 4 /* Intel WMMX control register */
135 }
136 _Unwind_VRS_RegClass;
137
138 typedef enum
139 {
140 _UVRSD_UINT32 = 0,
141 _UVRSD_VFPX = 1,
142 _UVRSD_FPAX = 2,
143 _UVRSD_UINT64 = 3,
144 _UVRSD_FLOAT = 4,
145 _UVRSD_DOUBLE = 5
146 }
147 _Unwind_VRS_DataRepresentation;
148
149 typedef enum
150 {
151 _UVRSR_OK = 0,
152 _UVRSR_NOT_IMPLEMENTED = 1,
153 _UVRSR_FAILED = 2
154 }
155 _Unwind_VRS_Result;
156
157 /* Frame unwinding state. */
158 typedef struct
159 {
160 /* The current word (bytes packed msb first). */
161 _uw data;
162 /* Pointer to the next word of data. */
163 _uw *next;
164 /* The number of bytes left in this word. */
165 _uw8 bytes_left;
166 /* The number of words pointed to by ptr. */
167 _uw8 words_left;
168 }
169 __gnu_unwind_state;
170
171 typedef _Unwind_Reason_Code (*personality_routine) (_Unwind_State,
172 _Unwind_Control_Block *, _Unwind_Context *);
173
174 _Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass,
175 _uw, _Unwind_VRS_DataRepresentation,
176 void *);
177
178 _Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass,
179 _uw, _Unwind_VRS_DataRepresentation,
180 void *);
181
182 _Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass,
183 _uw, _Unwind_VRS_DataRepresentation);
184
185
186 /* Support functions for the PR. */
187 #define _Unwind_Exception _Unwind_Control_Block
188 #ifdef __FreeBSD__
189 typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__)));
190 #else
191 typedef char _Unwind_Exception_Class[8];
192 #endif
193
194 void * _Unwind_GetLanguageSpecificData (_Unwind_Context *);
195 _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *);
196
197 _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *);
198 /* This should never be used. */
199 _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *);
200
201 /* Interface functions: */
202 _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp);
203 void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp);
204 _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp);
205
206 typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
207 (int, _Unwind_Action, _Unwind_Exception_Class,
208 _Unwind_Control_Block *, struct _Unwind_Context *, void *);
209 _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *,
210 _Unwind_Stop_Fn, void *);
211 /* @@@ Use unwind data to perform a stack backtrace. The trace callback
212 is called for every stack frame in the call chain, but no cleanup
213 actions are performed. */
214 typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (_Unwind_Context *, void *);
215 _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn,
216 void*);
217
218 _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);
219 void _Unwind_Complete(_Unwind_Control_Block *ucbp);
220 void _Unwind_DeleteException (_Unwind_Exception *);
221
222 _Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *,
223 _Unwind_Context *);
224 _Unwind_Reason_Code __gnu_unwind_execute (_Unwind_Context *,
225 __gnu_unwind_state *);
226
227 static inline _Unwind_Word
228 _Unwind_GetGR (_Unwind_Context *context, int regno)
229 {
230 _uw val;
231 _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
232 return val;
233 }
234
235 #define _Unwind_GetIPInfo(context, ip_before_insn) \
236 (*ip_before_insn = 0, _Unwind_GetIP (context))
237
238 static inline void
239 _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val)
240 {
241 _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
242 }
243
244 _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *);
245 void * _Unwind_GetLanguageSpecificData (_Unwind_Context *);
246
247 /* leb128 type numbers have a potentially unlimited size.
248 The target of the following definitions of _sleb128_t and _uleb128_t
249 is to have efficient data types large enough to hold the leb128 type
250 numbers used in the unwind code. */
251 typedef long _sleb128_t;
252 typedef unsigned long _uleb128_t;
253
254 #ifdef __cplusplus
255 } /* extern "C" */
256 #endif
257
258 #endif /* defined UNWIND_ARM_COMMON_H */