summaryrefslogtreecommitdiff
path: root/sys/arch/arm32
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/arm32
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/arm32')
-rw-r--r--sys/arch/arm32/arm32/vm_machdep.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/arch/arm32/arm32/vm_machdep.c b/sys/arch/arm32/arm32/vm_machdep.c
index 46c6517715d..7339a636b17 100644
--- a/sys/arch/arm32/arm32/vm_machdep.c
+++ b/sys/arch/arm32/arm32/vm_machdep.c
@@ -103,9 +103,11 @@ extern void child_return __P(());
*/
void
-cpu_fork(p1, p2)
+cpu_fork(p1, p2, stack, stacksize)
struct proc *p1;
struct proc *p2;
+ void *stack;
+ size_t stacksize;
{
struct user *up = p2->p_addr;
struct pcb *pcb = (struct pcb *)&p2->p_addr->u_pcb;
@@ -238,6 +240,13 @@ cpu_fork(p1, p2)
p2->p_md.md_regs = tf = (struct trapframe *)pcb->pcb_sp - 1;
*tf = *p1->p_md.md_regs;
+
+ /*
+ * If specified, give the child a different stack.
+ */
+ if (stack != NULL)
+ tf->tf_usr_sp = (u_int)stack + stacksize;
+
sf = (struct switchframe *)tf - 1;
sf->sf_spl = SPL_0;
sf->sf_r4 = (u_int)child_return;