Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha Duh, to set the user stack pointer, you...



details:   https://anonhg.NetBSD.org/src/rev/9192fe12b14e
branches:  trunk
changeset: 512898:9192fe12b14e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jul 18 22:22:49 2001 +0000

description:
Duh, to set the user stack pointer, you have to frob the PALcode PCB,
not the trap frame.

Fixes clone(2) on the Alpha.

diffstat:

 sys/arch/alpha/alpha/vm_machdep.c |  16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r 59aaa3d4521e -r 9192fe12b14e sys/arch/alpha/alpha/vm_machdep.c
--- a/sys/arch/alpha/alpha/vm_machdep.c Wed Jul 18 22:22:02 2001 +0000
+++ b/sys/arch/alpha/alpha/vm_machdep.c Wed Jul 18 22:22:49 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.71 2001/07/15 21:57:01 thorpej Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.72 2001/07/18 22:22:49 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.71 2001/07/15 21:57:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.72 2001/07/18 22:22:49 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -161,9 +161,13 @@
 
        /*
         * Copy pcb and user stack pointer from proc p1 to p2.
+        * If specificed, give the child a different stack.
         */
        p2->p_addr->u_pcb = p1->p_addr->u_pcb;
-       p2->p_addr->u_pcb.pcb_hw.apcb_usp = alpha_pal_rdusp();
+       if (stack != NULL)
+               p2->p_addr->u_pcb.pcb_hw.apcb_usp = (u_long)stack + stacksize;
+       else
+               p2->p_addr->u_pcb.pcb_hw.apcb_usp = alpha_pal_rdusp();
        simple_lock_init(&p2->p_addr->u_pcb.pcb_fpcpu_slock);
 
        /*
@@ -204,12 +208,6 @@
                p2tf->tf_regs[FRAME_A3] = 0;            /* no error */
                p2tf->tf_regs[FRAME_A4] = 1;            /* is child */
 
-               /*
-                * If specificed, give the child a different stack.
-                */
-               if (stack != NULL)
-                       p2tf->tf_regs[FRAME_SP] = (u_long)stack + stacksize;
-
                up->u_pcb.pcb_hw.apcb_ksp = (u_int64_t)p2tf;    
                up->u_pcb.pcb_context[0] =
                    (u_int64_t)func;                    /* s0: pc */



Home | Main Index | Thread Index | Old Index