]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libthread/alpha.c
doom: print correct version number on mismatch (thanks qu7uux)
[plan9front.git] / sys / src / libthread / alpha.c
1 #include <u.h>
2 #include <libc.h>
3 #include <thread.h>
4 #include "threadimpl.h"
5
6 /* first argument goes in a register and on the stack; avoid it */
7 static void
8 launcheralpha(int, void (*f)(void *arg), void *arg)
9 {
10         (*f)(arg);
11         threadexits(nil);
12 }
13
14 void
15 _threadinitstack(Thread *t, void (*f)(void*), void *arg)
16 {
17         ulong *tos;
18
19         tos = (ulong*)&t->stk[t->stksize&~7];
20
21         *--tos = 0;             /* pad arguments to 8 bytes */
22         *--tos = (ulong)arg;
23         *--tos = (ulong)f;
24         *--tos = 0;             /* first arg */
25
26         *--tos = 0;             /* for alignment with... */
27         *--tos = 0;             /* ... place to store return PC */
28
29         t->sched[JMPBUFPC] = (ulong)launcheralpha+JMPBUFDPC;
30         t->sched[JMPBUFSP] = (ulong)tos;
31 }
32