annotate gcc/ginclude/unwind-arm-common.h @ 131:84e7813d76e9

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