Blob


1 #include "threadimpl.h"
3 static void
4 launcherpower(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7,
5 void (*f)(void *arg), void *arg)
6 {
7 (*f)(arg);
8 threadexits(nil);
9 }
11 void
12 _threadinitstack(Thread *t, void (*f)(void*), void *arg)
13 {
14 ulong *tos, *stk;
16 tos = (ulong*)&t->stk[t->stksize&~7];
17 stk = tos;
18 --stk;
19 --stk;
20 --stk;
21 --stk;
22 *--stk = (ulong)arg;
23 *--stk = (ulong)f;
24 t->sched.pc = (ulong)launcherpower+LABELDPC;
25 t->sched.sp = (ulong)tos-80;
26 }