Changeset 25a1cb0 for libcfa/src/exception.c
- Timestamp:
- Sep 1, 2020, 1:18:10 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 86c1f1c3, a77496cb
- Parents:
- 8d8ac3b (diff), d3aa64f1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/exception.c
r8d8ac3b r25a1cb0 10 10 // Created On : Mon Jun 26 15:13:00 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 21 11:27:56202013 // Update Count : 2912 // Last Modified On : Sat Aug 29 15:52:22 2020 13 // Update Count : 34 14 14 // 15 15 … … 18 18 19 19 #include "exception.h" 20 21 // Implementation of the secret header is hardware dependent.22 #if defined( __x86_64 ) || defined( __i386 )23 #elif defined( __ARM_ARCH )24 #warning FIX ME: check if anything needed for ARM25 #else26 #warning Exception Handling: No known architecture detected.27 #endif28 20 29 21 #include <stdlib.h> … … 34 26 #include "stdhdr/assert.h" 35 27 36 // FIX ME: temporary hack to keep ARM build working 28 #if defined( __ARM_ARCH ) 29 #warning FIX ME: temporary hack to keep ARM build working 37 30 #ifndef _URC_FATAL_PHASE1_ERROR 38 31 #define _URC_FATAL_PHASE1_ERROR 3 … … 41 34 #define _URC_FATAL_PHASE2_ERROR 2 42 35 #endif // ! _URC_FATAL_PHASE2_ERROR 36 #endif // __ARM_ARCH 43 37 44 38 #include "lsda.h" … … 209 203 void * stop_param) { 210 204 // Verify actions follow the rules we expect. 211 verify((actions & _UA_CLEANUP_PHASE) && (actions & _UA_FORCE_UNWIND)); 212 verify(!(actions & (_UA_SEARCH_PHASE | _UA_HANDLER_FRAME))); 205 verify(actions & _UA_CLEANUP_PHASE); 206 verify(actions & _UA_FORCE_UNWIND); 207 verify(!(actions & _UA_SEARCH_PHASE)); 208 verify(!(actions & _UA_HANDLER_FRAME)); 213 209 214 210 if ( actions & _UA_END_OF_STACK ) { 215 exit(1);211 abort(); 216 212 } else { 217 213 return _URC_NO_REASON; … … 219 215 } 220 216 221 static struct _Unwind_Exception cancel_exception_storage; 217 __attribute__((weak)) _Unwind_Reason_Code 218 __cfaehm_cancellation_unwind( struct _Unwind_Exception * exception ) { 219 return _Unwind_ForcedUnwind( exception, _Stop_Fn, (void*)0x22 ); 220 } 222 221 223 222 // Cancel the current stack, prefroming approprate clean-up and messaging. 224 223 void __cfaehm_cancel_stack( exception_t * exception ) { 225 // TODO: Detect current stack and pick a particular stop-function. 224 __cfaehm_allocate_exception( exception ); 225 226 struct exception_context_t * context = this_exception_context(); 227 struct __cfaehm_node * node = EXCEPT_TO_NODE(context->current_exception); 228 229 // Preform clean-up of any extra active exceptions. 230 while ( node->next ) { 231 struct __cfaehm_node * to_free = node->next; 232 node->next = to_free->next; 233 exception_t * except = NODE_TO_EXCEPT( to_free ); 234 except->virtual_table->free( except ); 235 free( to_free ); 236 } 237 226 238 _Unwind_Reason_Code ret; 227 ret = _ Unwind_ForcedUnwind( &cancel_exception_storage, _Stop_Fn, (void*)0x22);239 ret = __cfaehm_cancellation_unwind( &node->unwind_exception ); 228 240 printf("UNWIND ERROR %d after force unwind\n", ret); 229 241 abort(); … … 608 620 609 621 #pragma GCC pop_options 622 623 #elif defined( __ARM_ARCH ) 624 _Unwind_Reason_Code __gcfa_personality_v0( 625 int version, 626 _Unwind_Action actions, 627 unsigned long long exception_class, 628 struct _Unwind_Exception * unwind_exception, 629 struct _Unwind_Context * unwind_context) { 630 return _URC_CONTINUE_UNWIND; 631 } 632 633 __attribute__((noinline)) 634 void __cfaehm_try_terminate(void (*try_block)(), 635 void (*catch_block)(int index, exception_t * except), 636 __attribute__((unused)) int (*match_block)(exception_t * except)) { 637 } 638 #else 639 #error unsupported hardware architecture 610 640 #endif // __x86_64 || __i386
Note:
See TracChangeset
for help on using the changeset viewer.