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/mvme68k | |
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/mvme68k')
-rw-r--r-- | sys/arch/mvme68k/mvme68k/vm_machdep.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c index 49b501eebde..d15397fb852 100644 --- a/sys/arch/mvme68k/mvme68k/vm_machdep.c +++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.11 1999/06/06 15:38:34 deraadt Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.12 1999/08/17 10:32:17 niklas Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -67,8 +67,10 @@ * the frame pointers on the stack after copying. */ void -cpu_fork(p1, p2) +cpu_fork(p1, p2, stack, stacksize) register struct proc *p1, *p2; + void *stack; + size_t stacksize; { register struct pcb *pcb = &p2->p_addr->u_pcb; register struct trapframe *tf; @@ -89,6 +91,13 @@ cpu_fork(p1, p2) tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1; p2->p_md.md_regs = (int *)tf; *tf = *(struct trapframe *)p1->p_md.md_regs; + + /* + * If specified, give the child a different stack. + */ + if (stack != NULL) + tf->tf_regs[15] = (u_int)stack + stacksize; + sf = (struct switchframe *)tf - 1; sf->sf_pc = (u_int)proc_trampoline; pcb->pcb_regs[6] = (int)child_return; /* A2 */ |