OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [arm/] [unwind-arm.h] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Header file for the ARM EABI unwinder
2
   Copyright (C) 2003, 2004, 2005, 2006  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 2, or (at your option) any
8
   later version.
9
 
10
   In addition to the permissions in the GNU General Public License, the
11
   Free Software Foundation gives you unlimited permission to link the
12
   compiled version of this file into combinations with other programs,
13
   and to distribute those combinations without any restriction coming
14
   from the use of this file.  (The General Public License restrictions
15
   do apply in other respects; for example, they cover modification of
16
   the file, and distribution when not linked into a combine
17
   executable.)
18
 
19
   This file is distributed in the hope that it will be useful, but
20
   WITHOUT ANY WARRANTY; without even the implied warranty of
21
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22
   General Public License for more details.
23
 
24
   You should have received a copy of the GNU General Public License
25
   along with this program; see the file COPYING.  If not, write to
26
   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27
   Boston, MA 02110-1301, USA.  */
28
 
29
/* Language-independent unwinder header public defines.  This contains both
30
   ABI defined objects, and GNU support routines.  */
31
 
32
#ifndef UNWIND_ARM_H
33
#define UNWIND_ARM_H
34
 
35
#define __ARM_EABI_UNWINDER__ 1
36
 
37
#ifdef __cplusplus
38
extern "C" {
39
#endif
40
  typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
41
  typedef signed _Unwind_Sword __attribute__((__mode__(__word__)));
42
  typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
43
  typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__)));
44
  typedef _Unwind_Word _uw;
45
  typedef unsigned _uw64 __attribute__((mode(__DI__)));
46
  typedef unsigned _uw16 __attribute__((mode(__HI__)));
47
  typedef unsigned _uw8 __attribute__((mode(__QI__)));
48
 
49
  typedef enum
50
    {
51
      _URC_OK = 0,       /* operation completed successfully */
52
      _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
53
      _URC_END_OF_STACK = 5,
54
      _URC_HANDLER_FOUND = 6,
55
      _URC_INSTALL_CONTEXT = 7,
56
      _URC_CONTINUE_UNWIND = 8,
57
      _URC_FAILURE = 9   /* unspecified failure of some kind */
58
    }
59
  _Unwind_Reason_Code;
60
 
61
  typedef enum
62
    {
63
      _US_VIRTUAL_UNWIND_FRAME = 0,
64
      _US_UNWIND_FRAME_STARTING = 1,
65
      _US_UNWIND_FRAME_RESUME = 2,
66
      _US_ACTION_MASK = 3,
67
      _US_FORCE_UNWIND = 8,
68
      _US_END_OF_STACK = 16
69
    }
70
  _Unwind_State;
71
 
72
  /* Provided only for for compatibility with existing code.  */
73
  typedef int _Unwind_Action;
74
#define _UA_SEARCH_PHASE        1
75
#define _UA_CLEANUP_PHASE       2
76
#define _UA_HANDLER_FRAME       4
77
#define _UA_FORCE_UNWIND        8
78
#define _UA_END_OF_STACK        16
79
#define _URC_NO_REASON  _URC_OK
80
 
81
  typedef struct _Unwind_Control_Block _Unwind_Control_Block;
82
  typedef struct _Unwind_Context _Unwind_Context;
83
  typedef _uw _Unwind_EHT_Header;
84
 
85
 
86
  /* UCB: */
87
 
88
  struct _Unwind_Control_Block
89
    {
90
      char exception_class[8];
91
      void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
92
      /* Unwinder cache, private fields for the unwinder's use */
93
      struct
94
        {
95
          _uw reserved1;  /* Forced unwind stop fn, 0 if not forced */
96
          _uw reserved2;  /* Personality routine address */
97
          _uw reserved3;  /* Saved callsite address */
98
          _uw reserved4;  /* Forced unwind stop arg */
99
          _uw reserved5;
100
        }
101
      unwinder_cache;
102
      /* Propagation barrier cache (valid after phase 1): */
103
      struct
104
        {
105
          _uw sp;
106
          _uw bitpattern[5];
107
        }
108
      barrier_cache;
109
      /* Cleanup cache (preserved over cleanup): */
110
      struct
111
        {
112
          _uw bitpattern[4];
113
        }
114
      cleanup_cache;
115
      /* Pr cache (for pr's benefit): */
116
      struct
117
        {
118
          _uw fnstart;                  /* function start address */
119
          _Unwind_EHT_Header *ehtp;     /* pointer to EHT entry header word */
120
          _uw additional;               /* additional data */
121
          _uw reserved1;
122
        }
123
      pr_cache;
124
      long long int :0;  /* Force alignment to 8-byte boundary */
125
    };
126
 
127
  /* Virtual Register Set*/
128
 
129
  typedef enum
130
    {
131
      _UVRSC_CORE = 0,      /* integer register */
132
      _UVRSC_VFP = 1,       /* vfp */
133
      _UVRSC_FPA = 2,       /* fpa */
134
      _UVRSC_WMMXD = 3,     /* Intel WMMX data register */
135
      _UVRSC_WMMXC = 4      /* Intel WMMX control register */
136
    }
137
  _Unwind_VRS_RegClass;
138
 
139
  typedef enum
140
    {
141
      _UVRSD_UINT32 = 0,
142
      _UVRSD_VFPX = 1,
143
      _UVRSD_FPAX = 2,
144
      _UVRSD_UINT64 = 3,
145
      _UVRSD_FLOAT = 4,
146
      _UVRSD_DOUBLE = 5
147
    }
148
  _Unwind_VRS_DataRepresentation;
149
 
150
  typedef enum
151
    {
152
      _UVRSR_OK = 0,
153
      _UVRSR_NOT_IMPLEMENTED = 1,
154
      _UVRSR_FAILED = 2
155
    }
156
  _Unwind_VRS_Result;
157
 
158
  /* Frame unwinding state.  */
159
  typedef struct
160
    {
161
      /* The current word (bytes packed msb first).  */
162
      _uw data;
163
      /* Pointer to the next word of data.  */
164
      _uw *next;
165
      /* The number of bytes left in this word.  */
166
      _uw8 bytes_left;
167
      /* The number of words pointed to by ptr.  */
168
      _uw8 words_left;
169
    }
170
  __gnu_unwind_state;
171
 
172
  typedef _Unwind_Reason_Code (*personality_routine) (_Unwind_State,
173
      _Unwind_Control_Block *, _Unwind_Context *);
174
 
175
  _Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass,
176
                                     _uw, _Unwind_VRS_DataRepresentation,
177
                                     void *);
178
 
179
  _Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass,
180
                                     _uw, _Unwind_VRS_DataRepresentation,
181
                                     void *);
182
 
183
  _Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass,
184
                                     _uw, _Unwind_VRS_DataRepresentation);
185
 
186
 
187
  /* Support functions for the PR.  */
188
#define _Unwind_Exception _Unwind_Control_Block
189
  typedef char _Unwind_Exception_Class[8];
190
 
191
  void * _Unwind_GetLanguageSpecificData (_Unwind_Context *);
192
  _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *);
193
 
194
  /* These two should never be used.  */
195
  _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *);
196
  _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *);
197
 
198
  /* Interface functions: */
199
  _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp);
200
  void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp);
201
  _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp);
202
 
203
  typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
204
       (int, _Unwind_Action, _Unwind_Exception_Class,
205
        _Unwind_Control_Block *, struct _Unwind_Context *, void *);
206
  _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *,
207
                                            _Unwind_Stop_Fn, void *);
208
  _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);
209
  void _Unwind_Complete(_Unwind_Control_Block *ucbp);
210
  void _Unwind_DeleteException (_Unwind_Exception *);
211
 
212
  _Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *,
213
                                          _Unwind_Context *);
214
  _Unwind_Reason_Code __gnu_unwind_execute (_Unwind_Context *,
215
                                            __gnu_unwind_state *);
216
 
217
  /* Decode an R_ARM_TARGET2 relocation.  */
218
  static inline _Unwind_Word
219
  _Unwind_decode_target2 (_Unwind_Word ptr)
220
    {
221
      _Unwind_Word tmp;
222
 
223
      tmp = *(_Unwind_Word *) ptr;
224
      /* Zero values are always NULL.  */
225
      if (!tmp)
226
        return 0;
227
 
228
#if defined(linux) || defined(__NetBSD__)
229
      /* Pc-relative indirect.  */
230
      tmp += ptr;
231
      tmp = *(_Unwind_Word *) tmp;
232
#elif defined(__symbian__)
233
      /* Absolute pointer.  Nothing more to do.  */
234
#else
235
      /* Pc-relative pointer.  */
236
      tmp += ptr;
237
#endif
238
      return tmp;
239
    }
240
 
241
  static inline _Unwind_Word
242
  _Unwind_GetGR (_Unwind_Context *context, int regno)
243
    {
244
      _uw val;
245
      _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
246
      return val;
247
    }
248
 
249
  /* Return the address of the instruction, not the actual IP value.  */
250
#define _Unwind_GetIP(context) \
251
  (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
252
 
253
#define _Unwind_GetIPInfo(context, ip_before_insn) \
254
  (*ip_before_insn = 0, _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
255
 
256
  static inline void
257
  _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val)
258
    {
259
      _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
260
    }
261
 
262
  /* The dwarf unwinder doesn't understand arm/thumb state.  We assume the
263
     landing pad uses the same instruction set as the call site.  */
264
#define _Unwind_SetIP(context, val) \
265
  _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1))
266
 
267
#ifdef __cplusplus
268
}   /* extern "C" */
269
#endif
270
 
271
#endif /* defined UNWIND_ARM_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.