aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-11-23 18:18:41 +0000
committerrsc <devnull@localhost>2003-11-23 18:18:41 +0000
commit8a708fb239f4272ac7e4f16f437093c56b2cab39 (patch)
treeca0d390ac36375519a50a0dec32ca3ce6cff8b68 /src
parentcd7ddc9b5f34da33a2eb0ea761681c2330284e69 (diff)
downloadplan9port-8a708fb239f4272ac7e4f16f437093c56b2cab39.tar.gz
plan9port-8a708fb239f4272ac7e4f16f437093c56b2cab39.tar.bz2
plan9port-8a708fb239f4272ac7e4f16f437093c56b2cab39.zip
sun support
Diffstat (limited to 'src')
-rw-r--r--src/libthread/asm-SunOS-sun4u.s51
-rw-r--r--src/libthread/exec-unix.c11
-rw-r--r--src/libthread/sun4u.c25
3 files changed, 76 insertions, 11 deletions
diff --git a/src/libthread/asm-SunOS-sun4u.s b/src/libthread/asm-SunOS-sun4u.s
new file mode 100644
index 00000000..3e95f02b
--- /dev/null
+++ b/src/libthread/asm-SunOS-sun4u.s
@@ -0,0 +1,51 @@
+.globl _setlabel
+.type _setlabel,#function
+
+_setlabel:
+ ta 3
+ st %i0, [%o0]
+ st %i1, [%o0+4]
+ st %i2, [%o0+8]
+ st %i3, [%o0+12]
+ st %i4, [%o0+16]
+ st %i5, [%o0+20]
+ st %i6, [%o0+24]
+ st %i7, [%o0+28]
+ st %l0, [%o0+32]
+ st %l1, [%o0+36]
+ st %l2, [%o0+40]
+ st %l3, [%o0+44]
+ st %l4, [%o0+48]
+ st %l5, [%o0+52]
+ st %l6, [%o0+56]
+ st %l7, [%o0+60]
+ st %sp, [%o0+64]
+ st %o7, [%o0+68]
+ jmpl %o7+8, %g0
+ or %g0, %g0, %o0
+
+.globl _gotolabel
+.type _gotolabel,#function
+
+_gotolabel:
+ ta 3
+ ld [%o0], %i0
+ ld [%o0+4], %i1
+ ld [%o0+8], %i2
+ ld [%o0+12], %i3
+ ld [%o0+16], %i4
+ ld [%o0+20], %i5
+ ld [%o0+24], %i6
+ ld [%o0+28], %i7
+ ld [%o0+32], %l0
+ ld [%o0+36], %l1
+ ld [%o0+40], %l2
+ ld [%o0+44], %l3
+ ld [%o0+48], %l4
+ ld [%o0+52], %l5
+ ld [%o0+56], %l6
+ ld [%o0+60], %l7
+ ld [%o0+64], %sp
+ ld [%o0+68], %o7
+ jmpl %o7+8, %g0
+ or %g0, 1, %o0
diff --git a/src/libthread/exec-unix.c b/src/libthread/exec-unix.c
index 6e4f7289..5a37e34c 100644
--- a/src/libthread/exec-unix.c
+++ b/src/libthread/exec-unix.c
@@ -9,13 +9,11 @@ procexec(Channel *pidc, char *prog, char *args[])
Proc *p;
Thread *t;
-print("procexec\n");
_threaddebug(DBGEXEC, "procexec %s", prog);
/* must be only thread in proc */
p = _threadgetproc();
t = p->thread;
if(p->threads.head != t || p->threads.head->nextt != nil){
-print("not only thread\n");
werrstr("not only thread in proc");
Bad:
if(pidc)
@@ -36,35 +34,26 @@ print("not only thread\n");
* pipe to us.
*/
if(pipe(p->exec.fd) < 0)
-{
-print("pipe\n");
goto Bad;
-}
if(fcntl(p->exec.fd[1], F_SETFD, 1) < 0)
-{
-print("fcntl\n");
goto Bad;
-}
/* exec in parallel via the scheduler */
assert(p->needexec==0);
p->exec.prog = prog;
p->exec.args = args;
p->needexec = 1;
-print("sched\n");
_sched();
close(p->exec.fd[1]);
if((n = read(p->exec.fd[0], p->exitstr, ERRMAX-1)) > 0){ /* exec failed */
p->exitstr[n] = '\0';
-print("read got %s\n", p->exitstr);
errstr(p->exitstr, ERRMAX);
close(p->exec.fd[0]);
goto Bad;
}
close(p->exec.fd[0]);
-print("exec %d\n", pidc);
if(pidc)
sendul(pidc, t->ret);
diff --git a/src/libthread/sun4u.c b/src/libthread/sun4u.c
new file mode 100644
index 00000000..5eb2135e
--- /dev/null
+++ b/src/libthread/sun4u.c
@@ -0,0 +1,25 @@
+#include "threadimpl.h"
+
+static void
+launchersparc(int o0, int o1, int o2, int o3, int o4,
+ void (*f)(void *arg), void *arg)
+{
+ (*f)(arg);
+ threadexits(nil);
+}
+
+void
+_threadinitstack(Thread *t, void (*f)(void*), void *arg)
+{
+ ulong *tos, *stk;
+
+ tos = (ulong*)&t->stk[t->stksize&~7];
+ stk = tos;
+ --stk;
+ *--stk = (ulong)arg;
+ *--stk = (ulong)f;
+ t->sched.link = (ulong)launchersparc - 8;
+ t->sched.input[6] = 0;
+ t->sched.sp = (ulong)stk - 0x5c;
+}
+