Provide a full frame stack space in the clone'd child.

This commit is contained in:
martin 2006-12-28 17:46:03 +00:00
parent d796584488
commit 1c4ebce529

View File

@ -1,4 +1,4 @@
/* $NetBSD: __clone.S,v 1.4 2006/12/28 10:02:43 martin Exp $ */
/* $NetBSD: __clone.S,v 1.5 2006/12/28 17:46:03 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -60,11 +60,17 @@ ENTRY(__clone)
mov %i2, %o0 ! setup flags arg for syscall
/*
* Store the function and the argument on our child's stack
* Allocate "caller's" frame in the child stack as ABI
* requires.
*
* We pass the function and the argument to the child by
* stashing them at the bottom of the frame. There they are
* safe from window spill would we need to take one as it's
* below the window save area.
*/
sub %o1, 8, %o1 ! make space on the child's stack
st %i0, [%o1] ! save func
st %i3, [%o1+4] ! save arg
sub %o1, CCFSZ, %o1 ! make space on the child's stack
st %i0, [%o1+CCFSZ-8] ! save func
st %i3, [%o1+CCFSZ-4] ! save arg
/*
* Args are now set up for system call as (flags, stack).
@ -75,11 +81,9 @@ ENTRY(__clone)
tst %o1 ! %o1 (rv[1]) == 0 in parent
1: bz 2f ! yes, parent
ld [%sp], %l0 ! grab the function
ld [%sp+4], %o0 ! and the argument from the stack
add %sp, 8, %sp ! restore the stack
ld [%sp+CCFSZ-8], %l0 ! grab the function...
call %l0 ! Call the clone's entry point.
nop
ld [%sp+CCFSZ-4], %o0 ! ...and the argument from the stack
CALL(_C_LABEL(_exit))
/* NOTREACHED */