ref: cebce1be70fbc8a5afd94909504e937be5b59b9d
parent: 5f7342a46178e8e2250f60ddd52a780671f045ea
author: aiju <[email protected]>
date: Sun Jun 26 09:37:14 EDT 2011
5e: fix _tos->pid / libthread bug
--- a/sys/src/cmd/5e/fns.h
+++ b/sys/src/cmd/5e/fns.h
@@ -35,3 +35,4 @@
void fpatransfer(u32int);
void fpaoperation(u32int);
void fparegtransfer(u32int);
+void inittos(void);
--- a/sys/src/cmd/5e/proc.c
+++ b/sys/src/cmd/5e/proc.c
@@ -108,8 +108,16 @@
ap += len;
}
*(ulong *) vaddrnol(sp, 4) = 0;
+ inittos();
+}
- ((Tos *) vaddrnol(tos, sizeof(Tos)))->pid = getpid();
+void
+inittos(void)
+{
+ ulong tos;
+
+ tos = mach->utop - sizeof(Tos) * 2;
+ ((Tos *) vaddrnol(tos, sizeof(Tos)))->pid = P->pid;
}
static int
--- a/sys/src/cmd/5e/sys.c
+++ b/sys/src/cmd/5e/sys.c
@@ -401,6 +401,7 @@
P = p;
atexit(cleanup);
P->pid = getpid();
+ inittos();
addproc(P);
}
P->R[0] = rc;