Changeset d119d613 for libcfa/src
- Timestamp:
- Aug 25, 2020, 3:18:37 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- ceb7db8
- Parents:
- 5fe7322
- Location:
- libcfa/src
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/Makefile.am
r5fe7322 rd119d613 53 53 54 54 thread_headers = concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa \ 55 concurrency/monitor.hfa concurrency/mutex.hfa 55 concurrency/monitor.hfa concurrency/mutex.hfa concurrency/exception.hfa 56 56 57 57 thread_libsrc = concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa \ -
libcfa/src/concurrency/coroutine.cfa
r5fe7322 rd119d613 215 215 return cor; 216 216 } 217 218 struct $coroutine * __cfactx_cor_active(void) {219 return active_coroutine();220 }221 217 } 222 218 -
libcfa/src/concurrency/invoke.c
r5fe7322 rd119d613 29 29 // Called from the kernel when starting a coroutine or task so must switch back to user mode. 30 30 31 extern struct $coroutine * __cfactx_cor_active(void);32 31 extern struct $coroutine * __cfactx_cor_finish(void); 33 32 extern void __cfactx_cor_leave ( struct $coroutine * ); … … 36 35 extern void disable_interrupts() OPTIONAL_THREAD; 37 36 extern void enable_interrupts( __cfaabi_dbg_ctx_param ); 38 39 struct exception_context_t * this_exception_context() {40 return &__get_stack( __cfactx_cor_active() )->exception_context;41 }42 37 43 38 void __cfactx_invoke_coroutine( -
libcfa/src/concurrency/invoke.h
r5fe7322 rd119d613 98 98 } 99 99 100 struct exception_context_t * this_exception_context();101 102 100 // struct which calls the monitor is accepting 103 101 struct __waitfor_mask_t { -
libcfa/src/exception.c
r5fe7322 rd119d613 209 209 void * stop_param) { 210 210 // 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))); 211 verify(actions & _UA_CLEANUP_PHASE); 212 verify(actions & _UA_FORCE_UNWIND); 213 verify(!(actions & _UA_SEARCH_PHASE)); 214 verify(!(actions & _UA_HANDLER_FRAME)); 213 215 214 216 if ( actions & _UA_END_OF_STACK ) { 215 exit(1);217 abort(); 216 218 } else { 217 219 return _URC_NO_REASON; … … 219 221 } 220 222 221 static struct _Unwind_Exception cancel_exception_storage; 223 __attribute__((weak)) _Unwind_Reason_Code 224 __cfaehm_cancellation_unwind( struct _Unwind_Exception * exception ) { 225 return _Unwind_ForcedUnwind( exception, _Stop_Fn, (void*)0x22 ); 226 } 222 227 223 228 // Cancel the current stack, prefroming approprate clean-up and messaging. 224 229 void __cfaehm_cancel_stack( exception_t * exception ) { 225 // TODO: Detect current stack and pick a particular stop-function. 230 __cfaehm_allocate_exception( exception ); 231 232 struct exception_context_t * context = this_exception_context(); 233 struct __cfaehm_node * node = EXCEPT_TO_NODE(context->current_exception); 234 235 // Preform clean-up of any extra active exceptions. 236 while ( node->next ) { 237 struct __cfaehm_node * to_free = node->next; 238 node->next = to_free->next; 239 exception_t * except = NODE_TO_EXCEPT( to_free ); 240 except->virtual_table->free( except ); 241 free( to_free ); 242 } 243 226 244 _Unwind_Reason_Code ret; 227 ret = _ Unwind_ForcedUnwind( &cancel_exception_storage, _Stop_Fn, (void*)0x22);245 ret = __cfaehm_cancellation_unwind( &node->unwind_exception ); 228 246 printf("UNWIND ERROR %d after force unwind\n", ret); 229 247 abort();
Note: See TracChangeset
for help on using the changeset viewer.