Ignore:
Timestamp:
Apr 11, 2019, 10:36:13 AM (3 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
3c06bba
Parents:
e8e457e
Message:

Fixed errno virtualization and enabled preemption during coroutine context switch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.cfa

    re8e457e r5c1a531  
    9191
    9292void ?{}( coroutine_desc & this, current_stack_info_t * info) with( this ) {
    93         context.errno_ = 0;
    9493        stack.storage = info->storage;
    9594        with(*stack.storage) {
     
    237236}
    238237
     238static int * __volatile_errno() __attribute__((noinline));
     239static int * __volatile_errno() { asm(""); return &errno; }
     240
    239241// KERNEL ONLY
    240242// runThread runs a thread by context switching
     
    271273        thrd_src->state = thrd_src->state == Halted ? Halted : Inactive;
    272274        proc_cor->state = Active;
     275        int local_errno = *__volatile_errno();
    273276
    274277        // set new coroutine that the processor is executing
     
    280283        proc_cor->state = proc_cor->state == Halted ? Halted : Inactive;
    281284        thrd_src->state = Active;
     285        *__volatile_errno() = local_errno;
    282286}
    283287
     
    380384        src->state = src->state == Halted ? Halted : Inactive;
    381385
    382         // SKULLDUGGERY normally interrupts are enable before leaving a coroutine ctxswitch.
    383         // Therefore, when first creating a coroutine, interrupts are enable before calling the main.
    384         // This is consistent with thread creation. However, when creating the main processor coroutine,
    385         // we wan't interrupts to be disabled. Therefore, we double-disable interrupts here so they will
    386         // stay disabled.
    387         disable_interrupts();
    388 
    389386        // context switch to specified coroutine
    390387        verify( dst->context.SP );
Note: See TracChangeset for help on using the changeset viewer.