diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-01-02 19:46:13 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-01-02 19:46:13 +0000 |
commit | b6d0f2d435827e6b04d18121326bd1e40aa1b18d (patch) | |
tree | e500d88d9f16441b769e453ebabb0a09e160e9de /sys/arch/m88k | |
parent | 7f1d54c6d1b54db86bce642c3c0fbfd81c7479c1 (diff) |
Faster signal trampoline code for m88k: instead of pushing everything on
the stack a la m68k, put handler arguments in register, transfer control
to the handler directly, but have it return in the sigcode.
While there, remove wrong comments about the sigcode being on top of the
user stack.
Diffstat (limited to 'sys/arch/m88k')
-rw-r--r-- | sys/arch/m88k/m88k/sig_machdep.c | 24 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/subr.S | 25 |
2 files changed, 21 insertions, 28 deletions
diff --git a/sys/arch/m88k/m88k/sig_machdep.c b/sys/arch/m88k/m88k/sig_machdep.c index 1b460a1b2bd..c9940964dfd 100644 --- a/sys/arch/m88k/m88k/sig_machdep.c +++ b/sys/arch/m88k/m88k/sig_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sig_machdep.c,v 1.3 2005/04/30 16:44:08 miod Exp $ */ +/* $OpenBSD: sig_machdep.c,v 1.4 2006/01/02 19:46:12 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -64,14 +64,11 @@ struct sigstate { }; /* - * WARNING: sigcode() in locore.s assumes the layout shown for sf_signo - * through sf_handler so... don't screw with them! + * WARNING: sigcode() in subr.s assumes sf_scp is the first field of the + * sigframe. */ struct sigframe { - int sf_signo; /* signo for handler */ - siginfo_t *sf_sip; struct sigcontext *sf_scp; /* context ptr for handler */ - sig_t sf_handler; /* handler addr for u_sigc */ struct sigcontext sf_sc; /* actual context */ siginfo_t sf_si; }; @@ -133,14 +130,11 @@ sendsig(sig_t catcher, int sig, int mask, unsigned long code, int type, /* * Build the signal context to be used by sigreturn. */ - sf.sf_signo = sig; sf.sf_scp = &fp->sf_sc; - sf.sf_handler = catcher; sf.sf_sc.sc_onstack = oonstack; sf.sf_sc.sc_mask = mask; if (psp->ps_siginfo & sigmask(sig)) { - sf.sf_sip = &fp->sf_si; initsiginfo(&sf.sf_si, sig, code, type, val); } @@ -159,11 +153,14 @@ sendsig(sig_t catcher, int sig, int mask, unsigned long code, int type, sigexit(p, SIGILL); /* NOTREACHED */ } + /* - * Build the argument list for the signal handler. - * Signal trampoline code is at base of user stack. + * Set up registers for the signal handler invocation. */ - addr = p->p_sigcode; + tf->tf_r[1] = p->p_sigcode; /* return to sigcode */ + tf->tf_r[2] = sig; /* first arg is signo */ + tf->tf_r[3] = (vaddr_t)&fp->sf_si; /* second arg is siginfo */ + addr = (vaddr_t)catcher; /* and resume in the handler */ #ifdef M88100 if (CPU_IS88100) { tf->tf_snip = (addr & NIP_ADDR) | NIP_V; @@ -175,7 +172,8 @@ sendsig(sig_t catcher, int sig, int mask, unsigned long code, int type, tf->tf_exip = (addr & XIP_ADDR); } #endif - tf->tf_r[31] = (unsigned)fp; + tf->tf_r[31] = (vaddr_t)fp; + #ifdef DEBUG if ((sigdebug & SDB_FOLLOW) || ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)) diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S index cd2e9ad3167..0ef756ac903 100644 --- a/sys/arch/m88k/m88k/subr.S +++ b/sys/arch/m88k/m88k/subr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.S,v 1.10 2005/12/03 16:52:16 miod Exp $ */ +/* $OpenBSD: subr.S,v 1.11 2006/01/02 19:46:12 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -1545,25 +1545,20 @@ ENTRY(longjmp) or r2,r0,1 /* - * Trampoline code. Gets copied to the top of - * user stack in exec. + * Signal trampoline code. + * The kernel arranges for the handler to be invoked directly, and return + * here. */ GLOBAL(sigcode) /* r31 points to sigframe */ - ld r3, r31, 4 /* siginfo_t* */ - ld r4, r31, 8 /* sigcontext* */ - ld r5, r31, 12 /* handler */ - jsr.n r5 - ld r2, r31, 0 /* signo */ - ld r2, r31, 8 /* sigcontext* */ - or r13, r0, SYS_sigreturn - tb0 0, r0, 128 /* syscall trap, calling sigreturn */ + ld r2, r31, 0 /* pick sigcontext* */ + or r13, r0, SYS_sigreturn + tb0 0, r0, 128 /* syscall trap, calling sigreturn */ NOP | failure return -#if 0 +#ifdef dontbother /* sigreturn will not return unless it fails */ NOP | success return #endif - /* sigreturn will not return unless it fails */ - or r13, r0, SYS_exit - tb0 0, r0, 128 /* syscall trap, exit */ + or r13, r0, SYS_exit + tb0 0, r0, 128 /* syscall trap, exit */ /* * this never returns, but we need to provide fetchable instructions * for the 88100 pipeline. |