void thread_yield() { __save_context(); dINT(); /* have active_thread point to the next thread */ sched_run(); eINT(); __restore_context(); }
/* * we must prevent the compiler to generate a prologue or an epilogue * for thread_yield_higher(), since we rely on the RETI instruction at the end * of its execution, in the inlined __restore_context() sub-function */ __attribute__((naked)) void thread_yield_higher(void) { __asm__("push r2"); /* save SR */ __disable_irq(); __save_context(); /* have sched_active_thread point to the next thread */ sched_run(); __restore_context(); UNREACHABLE(); }