When delivering a signal, arrange for the signal handler to be invoked

directly, using the trampoline only for the return path.
This commit is contained in:
thorpej 2002-07-01 03:10:01 +00:00
parent 83ec04ebe8
commit 0ba2c1b425
3 changed files with 14 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.100 2002/05/13 21:38:09 thorpej Exp $ */
/* $NetBSD: locore.s,v 1.101 2002/07/01 03:10:01 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -73,7 +73,7 @@
#include <machine/asm.h>
__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.100 2002/05/13 21:38:09 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.101 2002/07/01 03:10:01 thorpej Exp $");
#include "assym.h"
@ -272,26 +272,16 @@ backtolocore1:
/**************************************************************************/
/*
* Signal "trampoline" code. Invoked from RTE setup by sendsig().
* Signal "trampoline" code.
*
* On entry, stack & registers look like:
* The kernel arranges for the handler to be invoked directly. This
* trampoline is used only to return from the signal.
*
* a0 signal number
* a1 signal specific code
* a2 pointer to signal context frame (scp)
* pv address of handler
* sp+0 saved hardware state
* .
* .
* scp+0 beginning of signal context frame
* The stack pointer points to the saved sigcontext.
*/
NESTED_NOPROFILE(sigcode,0,0,ra,0,0)
lda sp, -16(sp) /* save the sigcontext pointer */
stq a2, 0(sp)
jsr ra, (t12) /* call the signal handler (t12==pv) */
ldq a0, 0(sp) /* get the sigcontext pointer */
lda sp, 16(sp)
mov sp, a0 /* get pointer to sigcontext */
CALLSYS_NOERROR(__sigreturn14) /* and call sigreturn() with it. */
mov v0, a0 /* if that failed, get error code */
CALLSYS_NOERROR(exit) /* and call exit() with it. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.254 2002/03/18 22:57:53 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.255 2002/07/01 03:10:01 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.254 2002/03/18 22:57:53 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255 2002/07/01 03:10:01 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1599,11 +1599,12 @@ sendsig(catcher, sig, mask, code)
#endif
/* Set up the registers to return to sigcode. */
frame->tf_regs[FRAME_PC] = (u_int64_t)p->p_sigctx.ps_sigcode;
frame->tf_regs[FRAME_PC] = (u_int64_t)catcher;
frame->tf_regs[FRAME_A0] = sig;
frame->tf_regs[FRAME_A1] = code;
frame->tf_regs[FRAME_A2] = (u_int64_t)scp;
frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */
frame->tf_regs[FRAME_RA] = (u_int64_t)p->p_sigctx.ps_sigcode;
alpha_pal_wrusp((unsigned long)scp);
/* Remember that we're now on the signal stack. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: osf1_sigcode.s,v 1.2 2002/05/13 21:37:12 thorpej Exp $ */
/* $NetBSD: osf1_sigcode.s,v 1.3 2002/07/01 03:10:02 thorpej Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@ -61,7 +61,7 @@
#include <compat/osf1/osf1_syscall.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_sigcode.s,v 1.2 2002/05/13 21:37:12 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: osf1_sigcode.s,v 1.3 2002/07/01 03:10:02 thorpej Exp $");
/*
* OSF/1 signal trampoline code.
@ -75,11 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: osf1_sigcode.s,v 1.2 2002/05/13 21:37:12 thorpej Exp
call_pal PAL_OSF1_callsys
NESTED_NOPROFILE(osf1_sigcode,0,0,ra,0,0)
lda sp, -16(sp)
stq a2, 0(sp)
jsr ra, (t12)
ldq a0, 0(sp)
lda sp, 16(sp)
mov sp, a0
OSF1_CALLSYS_NOERROR(sigreturn)
mov v0, a0
OSF1_CALLSYS_NOERROR(exit)