Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh5/sh5 When setting the SP for a process, copy the...



details:   https://anonhg.NetBSD.org/src/rev/3b82189ba7fd
branches:  trunk
changeset: 538825:3b82189ba7fd
user:      scw <scw%NetBSD.org@localhost>
date:      Thu Oct 31 14:20:39 2002 +0000

description:
When setting the SP for a process, copy the same value to the
process' FP for the sake of consistency.

diffstat:

 sys/arch/sh5/sh5/process_machdep.c |   4 ++--
 sys/arch/sh5/sh5/vm_machdep.c      |  10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 8feaeaa4f7d3 -r 3b82189ba7fd sys/arch/sh5/sh5/process_machdep.c
--- a/sys/arch/sh5/sh5/process_machdep.c        Thu Oct 31 14:10:07 2002 +0000
+++ b/sys/arch/sh5/sh5/process_machdep.c        Thu Oct 31 14:20:39 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: process_machdep.c,v 1.7 2002/10/24 13:58:48 scw Exp $  */
+/*     $NetBSD: process_machdep.c,v 1.8 2002/10/31 14:20:39 scw Exp $  */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -87,7 +87,7 @@
        tf->tf_caller.r7 = (register_t)(long)p->p_psstr;
 
        /* Align the stack as required by the SH-5 ABI */
-       tf->tf_caller.r15 = (register_t) (sstack & ~0xf);
+       tf->tf_caller.r15 = tf->tf_caller.r14 = (register_t) (sstack & ~0xf);
 
        /* Give the new process a clean set of FP regs */
        memset(&p->p_addr->u_pcb.pcb_ctx.sf_fpregs, 0, sizeof(struct fpregs));
diff -r 8feaeaa4f7d3 -r 3b82189ba7fd sys/arch/sh5/sh5/vm_machdep.c
--- a/sys/arch/sh5/sh5/vm_machdep.c     Thu Oct 31 14:10:07 2002 +0000
+++ b/sys/arch/sh5/sh5/vm_machdep.c     Thu Oct 31 14:20:39 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.4 2002/09/04 14:02:47 scw Exp $       */
+/*     $NetBSD: vm_machdep.c,v 1.5 2002/10/31 14:20:39 scw Exp $       */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -197,13 +197,15 @@
            ((char *)p2->p_addr + (USPACE - sizeof(*tf)));
 
        /* Child inherits parent's trapframe */
-       memcpy(tf, p1->p_md.md_regs, sizeof(*tf));
+       memcpy(tf, (char *)p1->p_addr + (USPACE - sizeof(*tf)), sizeof(*tf));
 
        /*
         * If the child is to have a different user-mode stack, fix it up now.
         */
-       if (stack != NULL)
+       if (stack != NULL) {
                tf->tf_caller.r15 = (register_t)(intptr_t)stack + stacksize;
+               tf->tf_caller.r14 = tf->tf_caller.r15;
+       }
 
        /*
         * Set the child's syscall return parameters to the values
@@ -217,7 +219,7 @@
         * Set up a switchframe which will vector through proc_trampoline
         */
        pcb->pcb_ctx.sf_pc = (register_t)(intptr_t)proc_trampoline;
-       pcb->pcb_ctx.sf_sp = (register_t)(intptr_t)tf;
+       pcb->pcb_ctx.sf_sp = pcb->pcb_ctx.sf_fp = (register_t)(intptr_t)tf;
        pcb->pcb_ctx.sf_r10 = (register_t)(intptr_t)func;
        pcb->pcb_ctx.sf_r11 = (register_t)(intptr_t)arg;
 }



Home | Main Index | Thread Index | Old Index