1 41b3e8b9 2020-01-20 rsc #include "threadimpl.h"
4 41b3e8b9 2020-01-20 rsc makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
8 41b3e8b9 2020-01-20 rsc sp = USPALIGN(ucp, 4);
10 41b3e8b9 2020-01-20 rsc memmove(sp, &argc+1, argc*sizeof(int));
11 41b3e8b9 2020-01-20 rsc *--sp = 0; /* return address */
12 41b3e8b9 2020-01-20 rsc ucp->uc_mcontext.mc_eip = (long)func;
13 41b3e8b9 2020-01-20 rsc ucp->uc_mcontext.mc_esp = (int)sp;
17 41b3e8b9 2020-01-20 rsc swapcontext(ucontext_t *oucp, ucontext_t *ucp)
19 41b3e8b9 2020-01-20 rsc if(getcontext(oucp) == 0)
20 41b3e8b9 2020-01-20 rsc setcontext(ucp);