static void return_to_redboot(int status) { CYGARC_HAL_SAVE_GP(); return_status = status; HAL_THREAD_LOAD_CONTEXT(&saved_context); // never returns // need this to balance above CYGARC_HAL_SAVE_GP on // some platforms. It will never run, though. CYGARC_HAL_RESTORE_GP(); }
static void trampoline(unsigned long entry) { typedef void code_fun(void); code_fun *fun = (code_fun *)entry; unsigned long oldints; HAL_DISABLE_INTERRUPTS(oldints); #ifdef HAL_ARCH_PROGRAM_NEW_STACK HAL_ARCH_PROGRAM_NEW_STACK(fun); #else (*fun)(); #endif HAL_THREAD_LOAD_CONTEXT(&saved_context); }
void context_main(void) { int i; CYG_TEST_INIT(); // Init all thread contexts: for( i = 0 ; i < THREADS; i++ ) { sp[i] = (CYG_ADDRWORD)stack[i]+STACKSIZE; HAL_THREAD_INIT_CONTEXT( sp[i], i, entry0, i*0x01010000 ); } // Load the first thread. HAL_THREAD_LOAD_CONTEXT( &sp[0] ); }