Rev 4383 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4383 | Rev 5963 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* Supporting functions for C exception handling. |
1 | /* Supporting functions for C exception handling. |
2 | Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc. |
2 | Copyright (C) 2002-2013 Free Software Foundation, Inc. |
3 | Contributed by Aldy Hernandez |
3 | Contributed by Aldy Hernandez |
4 | Shamelessly stolen from the Java front end. |
4 | Shamelessly stolen from the Java front end. |
Line 5... | Line 5... | ||
5 | 5 | ||
Line 91... | Line 91... | ||
91 | #endif |
91 | #endif |
Line 92... | Line 92... | ||
92 | 92 | ||
93 | #ifdef __USING_SJLJ_EXCEPTIONS__ |
93 | #ifdef __USING_SJLJ_EXCEPTIONS__ |
94 | #define PERSONALITY_FUNCTION __gcc_personality_sj0 |
94 | #define PERSONALITY_FUNCTION __gcc_personality_sj0 |
- | 95 | #define __builtin_eh_return_data_regno(x) x |
|
- | 96 | #elif defined(__SEH__) |
|
95 | #define __builtin_eh_return_data_regno(x) x |
97 | #define PERSONALITY_FUNCTION __gcc_personality_imp |
96 | #else |
98 | #else |
97 | #define PERSONALITY_FUNCTION __gcc_personality_v0 |
99 | #define PERSONALITY_FUNCTION __gcc_personality_v0 |
Line 98... | Line 100... | ||
98 | #endif |
100 | #endif |
Line 105... | Line 107... | ||
105 | _Unwind_Reason_Code |
107 | _Unwind_Reason_Code |
106 | PERSONALITY_FUNCTION (_Unwind_State state, |
108 | PERSONALITY_FUNCTION (_Unwind_State state, |
107 | struct _Unwind_Exception * ue_header, |
109 | struct _Unwind_Exception * ue_header, |
108 | struct _Unwind_Context * context) |
110 | struct _Unwind_Context * context) |
109 | #else |
111 | #else |
- | 112 | #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__) |
|
- | 113 | static |
|
- | 114 | #endif |
|
110 | _Unwind_Reason_Code |
115 | _Unwind_Reason_Code |
111 | PERSONALITY_FUNCTION (int, _Unwind_Action, _Unwind_Exception_Class, |
116 | PERSONALITY_FUNCTION (int, _Unwind_Action, _Unwind_Exception_Class, |
112 | struct _Unwind_Exception *, struct _Unwind_Context *); |
117 | struct _Unwind_Exception *, struct _Unwind_Context *); |
Line 113... | Line 118... | ||
113 | 118 | ||
Line 128... | Line 133... | ||
128 | if ((state & _US_ACTION_MASK) != _US_UNWIND_FRAME_STARTING) |
133 | if ((state & _US_ACTION_MASK) != _US_UNWIND_FRAME_STARTING) |
129 | CONTINUE_UNWINDING; |
134 | CONTINUE_UNWINDING; |
Line 130... | Line 135... | ||
130 | 135 | ||
131 | /* The dwarf unwinder assumes the context structure holds things like the |
136 | /* The dwarf unwinder assumes the context structure holds things like the |
132 | function and LSDA pointers. The ARM implementation caches these in |
137 | function and LSDA pointers. The ARM implementation caches these in |
133 | the exception header (UCB). To avoid rewriting everything we make the |
138 | the exception header (UCB). To avoid rewriting everything we make a |
134 | virtual IP register point at the UCB. */ |
139 | virtual scratch register point at the UCB. */ |
135 | ip = (_Unwind_Ptr) ue_header; |
140 | ip = (_Unwind_Ptr) ue_header; |
136 | _Unwind_SetGR (context, 12, ip); |
141 | _Unwind_SetGR (context, UNWIND_POINTER_REG, ip); |
137 | #else |
142 | #else |
138 | if (version != 1) |
143 | if (version != 1) |
Line 139... | Line 144... | ||
139 | return _URC_FATAL_PHASE1_ERROR; |
144 | return _URC_FATAL_PHASE1_ERROR; |
Line 225... | Line 230... | ||
225 | (_Unwind_Ptr) ue_header); |
230 | (_Unwind_Ptr) ue_header); |
226 | _Unwind_SetGR (context, __builtin_eh_return_data_regno (1), 0); |
231 | _Unwind_SetGR (context, __builtin_eh_return_data_regno (1), 0); |
227 | _Unwind_SetIP (context, landing_pad); |
232 | _Unwind_SetIP (context, landing_pad); |
228 | return _URC_INSTALL_CONTEXT; |
233 | return _URC_INSTALL_CONTEXT; |
229 | }>>>=> |
234 | } |
- | 235 | ||
- | 236 | #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__) |
|
- | 237 | EXCEPTION_DISPOSITION |
|
- | 238 | __gcc_personality_seh0 (PEXCEPTION_RECORD ms_exc, void *this_frame, |
|
- | 239 | PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp) |
|
- | 240 | { |
|
- | 241 | return _GCC_specific_handler (ms_exc, this_frame, ms_orig_context, |
|
- | 242 | ms_disp, __gcc_personality_imp); |
|
- | 243 | } |
|
- | 244 | #endif /* SEH */>>>=> |