Blob


1 #include "threadimpl.h"
3 static void
4 launcher386(void (*f)(void *arg), void *arg)
5 {
6 (*f)(arg);
7 threadexits(nil);
8 }
10 void
11 _threadinitstack(Thread *t, void (*f)(void*), void *arg)
12 {
13 ulong *tos;
15 tos = (ulong*)&t->stk[t->stksize&~7];
16 *--tos = (ulong)arg;
17 *--tos = (ulong)f;
18 t->sched.pc = (ulong)launcher386;
19 t->sched.sp = (ulong)tos - 8; /* old PC and new PC */
20 }