]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libthread/power.c
pc64: preserve reserved bits in CR0/CR4 for amd64 in mtrr setstate()
[plan9front.git] / sys / src / libthread / power.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; simplest just to ignore it */
7 static void
8 launcherpower(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         *--tos = (ulong)arg;
21         *--tos = (ulong)f;
22         *--tos = 0;     /* first arg to launchermips */
23         *--tos = 0;     /* place to store return PC */
24         t->sched[JMPBUFPC] = (ulong)launcherpower+JMPBUFDPC;
25         t->sched[JMPBUFSP] = (ulong)tos;
26 }
27