void cpu_switch_context_exit(void) { #ifdef NATIVE_AUTO_EXIT if (sched_num_threads <= 1) { DEBUG("cpu_switch_context_exit: last task has ended. exiting.\n"); real_exit(EXIT_SUCCESS); } #endif if (_native_in_isr == 0) { disableIRQ(); _native_in_isr = 1; native_isr_context.uc_stack.ss_sp = __isr_stack; native_isr_context.uc_stack.ss_size = SIGSTKSZ; native_isr_context.uc_stack.ss_flags = 0; makecontext(&native_isr_context, isr_cpu_switch_context_exit, 0); if (setcontext(&native_isr_context) == -1) { err(EXIT_FAILURE, "cpu_switch_context_exit: swapcontext"); } errx(EXIT_FAILURE, "1 this should have never been reached!!"); } else { isr_cpu_switch_context_exit(); } errx(EXIT_FAILURE, "3 this should have never been reached!!"); }
void cpu_switch_context_exit() { if (_native_in_isr == 0) { dINT(); _native_in_isr = 1; native_isr_context.uc_stack.ss_sp = __isr_stack; native_isr_context.uc_stack.ss_size = SIGSTKSZ; native_isr_context.uc_stack.ss_flags = 0; makecontext(&native_isr_context, isr_cpu_switch_context_exit, 0); if (setcontext(&native_isr_context) == -1) { err(EXIT_FAILURE, "cpu_switch_context_exit: swapcontext"); } } else { isr_cpu_switch_context_exit(); } errx(EXIT_FAILURE, "this should have never been reached!!"); }