diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-08-17 10:32:20 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-08-17 10:32:20 +0000 |
commit | d86a6c16672c6fd6de49e6c04095bbe180db8edf (patch) | |
tree | d4538cad037bcb5ad1572a3d144628a50e829859 /sys/arch/sparc | |
parent | 63b7a98cc57e3a3fbf4e70bcd27a4eb65721c359 (diff) |
New cpu_fork API to take a stack in which you point the child's stackpointer
to, at the bottom or the top, depending on your architecture's stack growth
direction. This is in preparation for Linux' clone(2) emulation.
port maintainers, please check that I did the work right.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/sparc/vm_machdep.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c index 4093ab1a2a5..19be99b222b 100644 --- a/sys/arch/sparc/sparc/vm_machdep.c +++ b/sys/arch/sparc/sparc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.9 1999/07/09 21:30:03 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.10 1999/08/17 10:32:18 niklas Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */ /* @@ -359,8 +359,10 @@ vunmapbuf(bp, sz) * the first element in struct user. */ void -cpu_fork(p1, p2) +cpu_fork(p1, p2, stack, stacksize) register struct proc *p1, *p2; + void *stack; + size_t stacksize; { register struct pcb *opcb = &p1->p_addr->u_pcb; register struct pcb *npcb = &p2->p_addr->u_pcb; @@ -409,6 +411,12 @@ cpu_fork(p1, p2) /* Copy parent's trapframe */ *tf2 = *(struct trapframe *)((int)opcb + USPACE - sizeof(*tf2)); + /* + * If specified, give the child a different stack. + */ + if (stack != NULL) + tf2->tf_out[6] = (u_int)stack + stacksize; + /* Duplicate efforts of syscall(), but slightly differently */ if (tf2->tf_global[1] & SYSCALL_G2RFLAG) { /* jmp %g2 (or %g7, deprecated) on success */ |