summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc
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/powerpc
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/powerpc')
-rw-r--r--sys/arch/powerpc/powerpc/vm_machdep.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/arch/powerpc/powerpc/vm_machdep.c b/sys/arch/powerpc/powerpc/vm_machdep.c
index d43e13da067..9a25dae28ea 100644
--- a/sys/arch/powerpc/powerpc/vm_machdep.c
+++ b/sys/arch/powerpc/powerpc/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.6 1999/01/23 19:41:33 rahnds Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.7 1999/08/17 10:32:17 niklas Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */
/*
@@ -47,8 +47,10 @@
* Finish a fork operation, with process p2 nearly set up.
*/
void
-cpu_fork(p1, p2)
+cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
+ void *stack;
+ size_t stacksize;
{
struct trapframe *tf;
struct callframe *cf;
@@ -71,6 +73,13 @@ cpu_fork(p1, p2)
stktop1 = (caddr_t)trapframe(p1);
stktop2 = (caddr_t)trapframe(p2);
bcopy(stktop1, stktop2, sizeof(struct trapframe));
+
+ /*
+ * If specified, give the child a different stack.
+ */
+ if (stack != NULL)
+ tf->fixreg[1] = (register_t)stack + stacksize;
+
stktop2 = (caddr_t)((u_long)stktop2 & ~15); /* Align stack pointer */
/*