5e: fix _tos->pid / libthread bug

This commit is contained in:
aiju 2011-06-26 13:37:14 +02:00
parent 5f7342a461
commit cebce1be70
3 changed files with 11 additions and 1 deletions

View file

@ -35,3 +35,4 @@ void invalid(u32int);
void fpatransfer(u32int);
void fpaoperation(u32int);
void fparegtransfer(u32int);
void inittos(void);

View file

@ -108,8 +108,16 @@ initstack(int argc, char **argv)
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

View file

@ -401,6 +401,7 @@ sysrfork(void)
P = p;
atexit(cleanup);
P->pid = getpid();
inittos();
addproc(P);
}
P->R[0] = rc;