Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.c

    rac2b598 r09f357ec  
    2929// Called from the kernel when starting a coroutine or task so must switch back to user mode.
    3030
    31 extern struct $coroutine * __cfactx_cor_finish(void);
    32 extern void __cfactx_cor_leave ( struct $coroutine * );
    33 extern void __cfactx_thrd_leave();
    34 
     31extern void __leave_coroutine ( struct coroutine_desc * );
     32extern struct coroutine_desc * __finish_coroutine(void);
     33extern void __leave_thread_monitor();
    3534extern void disable_interrupts() OPTIONAL_THREAD;
    3635extern void enable_interrupts( __cfaabi_dbg_ctx_param );
    3736
    38 void __cfactx_invoke_coroutine(
     37void CtxInvokeCoroutine(
    3938        void (*main)(void *),
    4039        void *this
    4140) {
    4241        // Finish setting up the coroutine by setting its state
    43         struct $coroutine * cor = __cfactx_cor_finish();
     42        struct coroutine_desc * cor = __finish_coroutine();
    4443
    4544        // Call the main of the coroutine
     
    4746
    4847        //Final suspend, should never return
    49         __cfactx_cor_leave( cor );
     48        __leave_coroutine( cor );
    5049        __cabi_abort( "Resumed dead coroutine" );
    5150}
    5251
    53 static _Unwind_Reason_Code __cfactx_coroutine_unwindstop(
     52static _Unwind_Reason_Code _CtxCoroutine_UnwindStop(
    5453        __attribute((__unused__)) int version,
    5554        _Unwind_Action actions,
     
    6261                // We finished unwinding the coroutine,
    6362                // leave it
    64                 __cfactx_cor_leave( param );
     63                __leave_coroutine( param );
    6564                __cabi_abort( "Resumed dead coroutine" );
    6665        }
     
    7069}
    7170
    72 void __cfactx_coroutine_unwind(struct _Unwind_Exception * storage, struct $coroutine * cor) __attribute__ ((__noreturn__));
    73 void __cfactx_coroutine_unwind(struct _Unwind_Exception * storage, struct $coroutine * cor) {
    74         _Unwind_Reason_Code ret = _Unwind_ForcedUnwind( storage, __cfactx_coroutine_unwindstop, cor );
     71void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage, struct coroutine_desc * cor) __attribute__ ((__noreturn__));
     72void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage, struct coroutine_desc * cor) {
     73        _Unwind_Reason_Code ret = _Unwind_ForcedUnwind( storage, _CtxCoroutine_UnwindStop, cor );
    7574        printf("UNWIND ERROR %d after force unwind\n", ret);
    7675        abort();
    7776}
    7877
    79 void __cfactx_invoke_thread(
     78void CtxInvokeThread(
    8079        void (*main)(void *),
    8180        void *this
     
    9493        // The order of these 4 operations is very important
    9594        //Final suspend, should never return
    96         __cfactx_thrd_leave();
     95        __leave_thread_monitor();
    9796        __cabi_abort( "Resumed dead thread" );
    9897}
    9998
    100 void __cfactx_start(
     99void CtxStart(
    101100        void (*main)(void *),
    102         struct $coroutine * cor,
     101        struct coroutine_desc * cor,
    103102        void *this,
    104103        void (*invoke)(void *)
     
    140139
    141140        fs->dummyReturn = NULL;
    142         fs->rturn = __cfactx_invoke_stub;
     141        fs->rturn = CtxInvokeStub;
    143142        fs->fixedRegisters[0] = main;
    144143        fs->fixedRegisters[1] = this;
     
    158157        struct FakeStack *fs = (struct FakeStack *)cor->context.SP;
    159158
    160         fs->intRegs[8] = __cfactx_invoke_stub;
     159        fs->intRegs[8] = CtxInvokeStub;
    161160        fs->arg[0] = this;
    162161        fs->arg[1] = invoke;
Note: See TracChangeset for help on using the changeset viewer.