When forking a new LWP, if a new user stack pointer is provided, use it.

Necessary to make regress/lib/libc/clone pass.
This commit is contained in:
bjh21 2006-10-14 17:51:37 +00:00
parent 4ee87b9180
commit 2121e75b3f

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.11 2006/05/10 06:24:02 skrll Exp $ */
/* $NetBSD: vm_machdep.c,v 1.12 2006/10/14 17:51:37 bjh21 Exp $ */
/*-
* Copyright (c) 2000, 2001 Ben Harris
@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.11 2006/05/10 06:24:02 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.12 2006/10/14 17:51:37 bjh21 Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -128,6 +128,9 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
bzero(tf, sizeof(*tf));
else
*tf = *l1->l_addr->u_pcb.pcb_tf;
/* If specified, give the child a different stack. */
if (stack != NULL)
tf->tf_usr_sp = (u_int)stack + stacksize;
l2->l_addr->u_pcb.pcb_tf = tf;
/* Fabricate a new switchframe */
bzero(sf, sizeof(*sf));