summaryrefslogtreecommitdiff
path: root/sys/arch/atari
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1999-08-17 10:32:20 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1999-08-17 10:32:20 +0000
commitd86a6c16672c6fd6de49e6c04095bbe180db8edf (patch)
treed4538cad037bcb5ad1572a3d144628a50e829859 /sys/arch/atari
parent63b7a98cc57e3a3fbf4e70bcd27a4eb65721c359 (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/atari')
-rw-r--r--sys/arch/atari/atari/vm_machdep.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/arch/atari/atari/vm_machdep.c b/sys/arch/atari/atari/vm_machdep.c
index 8799926f17d..1eb03c4dd00 100644
--- a/sys/arch/atari/atari/vm_machdep.c
+++ b/sys/arch/atari/atari/vm_machdep.c
@@ -69,8 +69,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;
@@ -91,6 +93,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 */