Module Name: src Committed By: matt Date: Sat Mar 24 17:52:35 UTC 2012
Modified Files: src/sys/arch/powerpc/powerpc: vm_machdep.c Log Message: When a stack is specified, make sure the stack has enough for a previous callframe in which the LR can be stored. (atf test t_clone:clone_basic now passes). To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/arch/powerpc/powerpc/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/powerpc/powerpc/vm_machdep.c diff -u src/sys/arch/powerpc/powerpc/vm_machdep.c:1.95 src/sys/arch/powerpc/powerpc/vm_machdep.c:1.96 --- src/sys/arch/powerpc/powerpc/vm_machdep.c:1.95 Sun Feb 19 21:06:25 2012 +++ src/sys/arch/powerpc/powerpc/vm_machdep.c Sat Mar 24 17:52:35 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.95 2012/02/19 21:06:25 rmind Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.96 2012/03/24 17:52:35 matt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.95 2012/02/19 21:06:25 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.96 2012/03/24 17:52:35 matt Exp $"); #include "opt_altivec.h" #include "opt_multiprocessor.h" @@ -108,10 +108,13 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2->l_md.md_utf = *l1->l_md.md_utf; /* - * If specified, give the child a different stack. + * If specified, give the child a different stack. Make sure to + * reserve enough at the top to store the previous LR. */ if (stack != NULL) { - l2->l_md.md_utf->tf_fixreg[1] = (register_t)stack + stacksize; + l2->l_md.md_utf->tf_fixreg[1] = + ((register_t)stack + stacksize - STACK_ALIGNBYTES) + & ~STACK_ALIGNBYTES; } /*