Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
This commit is contained in:
parent
da6eeb0e4d
commit
476755a88c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.113 2008/04/28 20:23:10 martin Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.114 2009/06/01 20:58:16 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.113 2008/04/28 20:23:10 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.114 2009/06/01 20:58:16 martin Exp $");
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
@ -748,6 +748,16 @@ LEAF_NOPROFILE(lwp_trampoline, 0)
|
||||
jmp zero, (pv)
|
||||
END(lwp_trampoline)
|
||||
|
||||
/*
|
||||
* Simplified version of above: don't call lwp_startup()
|
||||
*/
|
||||
LEAF_NOPROFILE(setfunc_trampoline, 0)
|
||||
mov s0, pv
|
||||
mov s1, ra
|
||||
mov s2, a0
|
||||
jmp zero, (pv)
|
||||
END(setfunc_trampoline)
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.99 2009/03/16 23:11:09 dsl Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.100 2009/06/01 20:58:16 martin 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.99 2009/03/16 23:11:09 dsl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.100 2009/06/01 20:58:16 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -85,6 +85,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
|
||||
void (*func)(void *), void *arg)
|
||||
{
|
||||
struct user *up = l2->l_addr;
|
||||
extern void lwp_trampoline(void);
|
||||
|
||||
l2->l_md.md_tf = l1->l_md.md_tf;
|
||||
l2->l_md.md_flags = l1->l_md.md_flags & (MDP_FPUSED | MDP_FP_C);
|
||||
@ -150,7 +151,19 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
|
||||
l2tf->tf_regs[FRAME_A3] = 0; /* no error */
|
||||
l2tf->tf_regs[FRAME_A4] = 1; /* is child */
|
||||
|
||||
cpu_setfunc(l2, func, arg);
|
||||
up = l2->l_addr;
|
||||
up->u_pcb.pcb_hw.apcb_ksp =
|
||||
(u_int64_t)l2->l_md.md_tf;
|
||||
up->u_pcb.pcb_context[0] =
|
||||
(u_int64_t)func; /* s0: pc */
|
||||
up->u_pcb.pcb_context[1] =
|
||||
(u_int64_t)exception_return; /* s1: ra */
|
||||
up->u_pcb.pcb_context[2] =
|
||||
(u_int64_t)arg; /* s2: arg */
|
||||
up->u_pcb.pcb_context[3] =
|
||||
(u_int64_t)l2; /* s3: lwp */
|
||||
up->u_pcb.pcb_context[7] =
|
||||
(u_int64_t)lwp_trampoline; /* ra: assembly magic */
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,6 +171,7 @@ void
|
||||
cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)
|
||||
{
|
||||
struct user *up = l->l_addr;
|
||||
extern void setfunc_trampoline(void);
|
||||
|
||||
up->u_pcb.pcb_hw.apcb_ksp =
|
||||
(u_int64_t)l->l_md.md_tf;
|
||||
@ -167,10 +181,8 @@ cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)
|
||||
(u_int64_t)exception_return; /* s1: ra */
|
||||
up->u_pcb.pcb_context[2] =
|
||||
(u_int64_t)arg; /* s2: arg */
|
||||
up->u_pcb.pcb_context[3] =
|
||||
(u_int64_t)l; /* s3: lwp */
|
||||
up->u_pcb.pcb_context[7] =
|
||||
(u_int64_t)lwp_trampoline; /* ra: assembly magic */
|
||||
(u_int64_t)setfunc_trampoline; /* ra: assembly magic */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: alpha.h,v 1.23 2007/11/28 17:40:03 ad Exp $ */
|
||||
/* $NetBSD: alpha.h,v 1.24 2009/06/01 20:58:16 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
@ -139,7 +139,6 @@ void hwrpb_restart_setup(void);
|
||||
void regdump(struct trapframe *);
|
||||
void regtoframe(const struct reg *, struct trapframe *);
|
||||
void savectx(struct pcb *);
|
||||
void lwp_trampoline(void); /* MAGIC */
|
||||
void trap(unsigned long, unsigned long, unsigned long, unsigned long,
|
||||
struct trapframe *);
|
||||
void trap_init(void);
|
||||
|
Loading…
Reference in New Issue
Block a user