When delivering a signal, don't push the signum, code, and context pointer,
or handler onto the stack. Instead, just stuff them into the correct argument registers (handler is a "4th arg").
This commit is contained in:
parent
46c82860b1
commit
508e2dcf41
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: frame.h,v 1.8 2002/05/09 12:25:41 uch Exp $ */
|
||||
/* $NetBSD: frame.h,v 1.9 2002/06/23 18:35:05 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
|
||||
@ -98,10 +98,6 @@ struct switchframe {
|
||||
* Signal frame
|
||||
*/
|
||||
struct sigframe {
|
||||
int sf_signum;
|
||||
int sf_code;
|
||||
struct sigcontext *sf_scp;
|
||||
sig_t sf_handler;
|
||||
struct sigcontext sf_sc;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: genassym.cf,v 1.5 2002/05/09 12:29:16 uch Exp $
|
||||
# $NetBSD: genassym.cf,v 1.6 2002/06/23 18:35:07 thorpej Exp $
|
||||
|
||||
#-
|
||||
# Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -90,8 +90,6 @@ define SF_PR offsetof(struct switchframe, sf_pr)
|
||||
define SF_R6_BANK offsetof(struct switchframe, sf_r6_bank)
|
||||
define SF_R7_BANK offsetof(struct switchframe, sf_r7_bank)
|
||||
|
||||
define SIGF_HANDLER offsetof(struct sigframe, sf_handler)
|
||||
define SIGF_SC offsetof(struct sigframe, sf_sc)
|
||||
define SC_EFLAGS offsetof(struct sigcontext, sc_ssr)
|
||||
|
||||
# can't include sys/proc.h directly.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore_subr.S,v 1.10 2002/05/09 12:28:08 uch Exp $ */
|
||||
/* $NetBSD: locore_subr.S,v 1.11 2002/06/23 18:35:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -340,18 +340,22 @@ NENTRY(proc_trampoline)
|
||||
/*
|
||||
* sigcode:
|
||||
* Signal trampoline. copied to top of user stack.
|
||||
*
|
||||
* On entry, the registers and stack look like this:
|
||||
*
|
||||
* r4 signal number
|
||||
* r5 signal specific code
|
||||
* r6 pointer to sigcontext structure
|
||||
* r7 address of handler
|
||||
*
|
||||
* sp-> sigcontext structure
|
||||
*/
|
||||
NENTRY(sigcode)
|
||||
mov r15, r0
|
||||
mov.l @r0, r4
|
||||
add #SIGF_HANDLER, r0
|
||||
mov.l @r0, r0
|
||||
jsr @r0 /* (*sf_handler)(sf_signum) */
|
||||
jsr @r7 /* call handler */
|
||||
nop
|
||||
mov r15, r4
|
||||
add #SIGF_SC, r4
|
||||
mov r15, r4 /* get pointer to sigcontext */
|
||||
mov.l _L.SYS___sigreturn14, r0
|
||||
trapa #0x80 /* enter kernel with args on stack */
|
||||
trapa #0x80 /* and call sigreturn() */
|
||||
mov.l _L.SYS_exit, r0
|
||||
trapa #0x80 /* exit if sigreturn fails */
|
||||
.align 2
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sh3_machdep.c,v 1.41 2002/05/10 15:25:13 uch Exp $ */
|
||||
/* $NetBSD: sh3_machdep.c,v 1.42 2002/06/23 18:35:07 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc.
|
||||
@ -394,12 +394,6 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
|
||||
fp = (struct sigframe *)tf->tf_r15;
|
||||
fp--;
|
||||
|
||||
/* Build stack frame for signal trampoline. */
|
||||
frame.sf_signum = sig;
|
||||
frame.sf_code = code;
|
||||
frame.sf_scp = &fp->sf_sc;
|
||||
frame.sf_handler = catcher;
|
||||
|
||||
/* Save register context. */
|
||||
frame.sf_sc.sc_ssr = tf->tf_ssr;
|
||||
frame.sf_sc.sc_spc = tf->tf_spc;
|
||||
@ -440,6 +434,10 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
|
||||
/*
|
||||
* Build context to run handler in.
|
||||
*/
|
||||
tf->tf_r4 = sig;
|
||||
tf->tf_r5 = code;
|
||||
tf->tf_r6 = (int)&fp->sf_sc;
|
||||
tf->tf_r7 = (int)catcher;
|
||||
tf->tf_spc = (int)p->p_sigctx.ps_sigcode;
|
||||
tf->tf_r15 = (int)fp;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user