1 ba940ae6 2009-11-18 rsc #include "threadimpl.h"
4 ba940ae6 2009-11-18 rsc makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...)
9 9cf92718 2011-05-18 rsc sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
10 9cf92718 2011-05-18 rsc va_start(arg, argc);
11 9cf92718 2011-05-18 rsc for(i=0; i<4 && i<argc; i++)
12 9cf92718 2011-05-18 rsc (&uc->uc_mcontext.arm_r0)[i] = va_arg(arg, uint);
14 9cf92718 2011-05-18 rsc uc->uc_mcontext.arm_sp = (uint)sp;
15 9cf92718 2011-05-18 rsc uc->uc_mcontext.arm_lr = (uint)fn;
19 ba940ae6 2009-11-18 rsc swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
21 9cf92718 2011-05-18 rsc if(getcontext(oucp) == 0)
22 9cf92718 2011-05-18 rsc setcontext(ucp);