Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/powerpc When a stack is specified, make sur...



details:   https://anonhg.NetBSD.org/src/rev/abd50193b35f
branches:  trunk
changeset: 778393:abd50193b35f
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Mar 24 17:52:35 2012 +0000

description:
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).

diffstat:

 sys/arch/powerpc/powerpc/vm_machdep.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r a8f84ee1f4cc -r abd50193b35f sys/arch/powerpc/powerpc/vm_machdep.c
--- a/sys/arch/powerpc/powerpc/vm_machdep.c     Sat Mar 24 08:22:24 2012 +0000
+++ b/sys/arch/powerpc/powerpc/vm_machdep.c     Sat Mar 24 17:52:35 2012 +0000
@@ -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 @@
        *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;
        }
 
        /*



Home | Main Index | Thread Index | Old Index