From 76193d7cb0457807b2f0b95f909ab5de19480cd7 Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 30 Sep 2003 17:47:42 +0000 Subject: Initial revision --- src/libthread/386.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/libthread/386.c (limited to 'src/libthread/386.c') diff --git a/src/libthread/386.c b/src/libthread/386.c new file mode 100644 index 00000000..2f391bff --- /dev/null +++ b/src/libthread/386.c @@ -0,0 +1,21 @@ +#include "threadimpl.h" + +static void +launcher386(void (*f)(void *arg), void *arg) +{ + (*f)(arg); + threadexits(nil); +} + +void +_threadinitstack(Thread *t, void (*f)(void*), void *arg) +{ + ulong *tos; + + tos = (ulong*)&t->stk[t->stksize&~7]; + *--tos = (ulong)arg; + *--tos = (ulong)f; + t->sched.pc = (ulong)launcher386; + t->sched.sp = (ulong)tos - 8; /* old PC and new PC */ +} + -- cgit v1.2.3