aboutsummaryrefslogtreecommitdiff
path: root/src/libthread
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-11-25 02:11:11 +0000
committerrsc <devnull@localhost>2003-11-25 02:11:11 +0000
commit64bcfff3a12695f4e3f54b0590e896611da71c3b (patch)
tree4069bf27ba50ec5fa81e1ca201fc38cf3cb496be /src/libthread
parentf7012583e9a7594cbb5ebe8e974bb69061189262 (diff)
downloadplan9port-64bcfff3a12695f4e3f54b0590e896611da71c3b.tar.gz
plan9port-64bcfff3a12695f4e3f54b0590e896611da71c3b.tar.bz2
plan9port-64bcfff3a12695f4e3f54b0590e896611da71c3b.zip
More tweaks on Linux and Solaris.
Diffstat (limited to 'src/libthread')
-rw-r--r--src/libthread/sched.c2
-rw-r--r--src/libthread/sun4u.c20
2 files changed, 19 insertions, 3 deletions
diff --git a/src/libthread/sched.c b/src/libthread/sched.c
index b9e646e3..293e3306 100644
--- a/src/libthread/sched.c
+++ b/src/libthread/sched.c
@@ -10,7 +10,6 @@ static char *_psstate[] = {
"Ready",
"Rendezvous",
};
-#endif
static char*
psstate(int s)
@@ -19,6 +18,7 @@ psstate(int s)
return "unknown";
return _psstate[s];
}
+#endif
void
_schedinit(void *arg)
diff --git a/src/libthread/sun4u.c b/src/libthread/sun4u.c
index 5eb2135e..0c298c62 100644
--- a/src/libthread/sun4u.c
+++ b/src/libthread/sun4u.c
@@ -1,9 +1,12 @@
#include "threadimpl.h"
static void
-launchersparc(int o0, int o1, int o2, int o3, int o4,
+launchersparc(uint o0, uint o1, uint o2, uint o3,
+ uint o4, uint o5, uint o6, uint o7,
void (*f)(void *arg), void *arg)
{
+ if(0) print("ls %x %x %x %x %x %x %x %x %x %x at %x\n",
+ o0, o1, o2, o3, o4, o5, o6, o7, f, arg, &o0);
(*f)(arg);
threadexits(nil);
}
@@ -13,13 +16,26 @@ _threadinitstack(Thread *t, void (*f)(void*), void *arg)
{
ulong *tos, *stk;
+ /*
+ * This is a bit more complicated than it should be,
+ * because we need to set things up so that gotolabel
+ * (which executes a return) gets us into launchersparc.
+ * So all the registers are going to be renamed before
+ * we get there. The input registers here become the
+ * output registers there, which is useless.
+ * The input registers there are inaccessible, so we
+ * have to give launchersparc enough arguments that
+ * everything ends up in the stack.
+ */
tos = (ulong*)&t->stk[t->stksize&~7];
stk = tos;
--stk;
*--stk = (ulong)arg;
*--stk = (ulong)f;
+ stk -= 25; /* would love to understand this */
t->sched.link = (ulong)launchersparc - 8;
t->sched.input[6] = 0;
- t->sched.sp = (ulong)stk - 0x5c;
+ t->sched.sp = (ulong)stk;
+ if(0) print("tis %x %x at %x\n", f, arg, t->sched.sp);
}