Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh3/sh3 cpu_setfunc() must use lwp_trampoline to ar...



details:   https://anonhg.NetBSD.org/src/rev/d97c7d768fae
branches:  trunk
changeset: 761562:d97c7d768fae
user:      uwe <uwe%NetBSD.org@localhost>
date:      Tue Feb 01 01:54:14 2011 +0000

description:
cpu_setfunc() must use lwp_trampoline to arrange for the recycled lwp
to go through lwp_startup() the first time it's switched to.

This makes NetBSD-4.x SA binaries work on current.  Tested with dig(1)
in NetBSD-4.x chroot on landisk.

Looks like this mistake of mine was picked up and replicated in
several other ports, sorry.

Reported by chuck@ in PR kern/44500

diffstat:

 sys/arch/sh3/sh3/locore_subr.S |  5 ++---
 sys/arch/sh3/sh3/vm_machdep.c  |  8 ++++----
 2 files changed, 6 insertions(+), 7 deletions(-)

diffs (62 lines):

diff -r 0d359f53636b -r d97c7d768fae sys/arch/sh3/sh3/locore_subr.S
--- a/sys/arch/sh3/sh3/locore_subr.S    Tue Feb 01 01:43:15 2011 +0000
+++ b/sys/arch/sh3/sh3/locore_subr.S    Tue Feb 01 01:54:14 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore_subr.S,v 1.53 2010/03/20 23:31:30 chs Exp $     */
+/*     $NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $     */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #include <sh3/mmu_sh3.h>
 #include <sh3/mmu_sh4.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.53 2010/03/20 23:31:30 chs Exp $")
+__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $")
 
 
 /*
@@ -388,7 +388,6 @@
        mov     r0, r4          /* previous lwp returned by cpu_switchto */
        jsr     @r1
         mov    r10, r5         /* my struct lwp */
-ALTENTRY(lwp_setfunc_trampoline)
        jsr     @r12
         mov    r11, r4
        __EXCEPTION_RETURN
diff -r 0d359f53636b -r d97c7d768fae sys/arch/sh3/sh3/vm_machdep.c
--- a/sys/arch/sh3/sh3/vm_machdep.c     Tue Feb 01 01:43:15 2011 +0000
+++ b/sys/arch/sh3/sh3/vm_machdep.c     Tue Feb 01 01:54:14 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.69 2011/01/14 02:06:31 rmind Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.70 2011/02/01 01:54:14 uwe Exp $      */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.69 2011/01/14 02:06:31 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.70 2011/02/01 01:54:14 uwe Exp $");
 
 #include "opt_kstack_debug.h"
 
@@ -107,7 +107,6 @@
 #include <sh3/userret.h>
 
 extern void lwp_trampoline(void);
-extern void lwp_setfunc_trampoline(void);
 
 static void sh3_setup_uarea(struct lwp *);
 
@@ -176,7 +175,8 @@
        l->l_md.md_regs->tf_ssr = PSL_USERSET;
 
        /* When lwp is switched to, jump to the trampoline */
-       sf->sf_pr  = (int)lwp_setfunc_trampoline;
+       sf->sf_pr  = (int)lwp_trampoline;
+       sf->sf_r10 = (int)l;    /* "new" lwp for lwp_startup() */
        sf->sf_r11 = (int)arg;  /* hook function/argument */
        sf->sf_r12 = (int)func;
 }



Home | Main Index | Thread Index | Old Index