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
This commit is contained in:
uwe 2011-02-01 01:54:14 +00:00
parent 3cb4a8235c
commit 745f41f7e7
2 changed files with 6 additions and 7 deletions

View File

@ -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 @@ NENTRY(lwp_trampoline)
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

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.69 2011/01/14 02:06:31 rmind Exp $"
#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 @@ cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)
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;
}