Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sh3 When delivering a signal, don't push the signum...



details:   https://anonhg.NetBSD.org/src/rev/ff06a1a76bd4
branches:  trunk
changeset: 533169:ff06a1a76bd4
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 23 18:35:05 2002 +0000

description:
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").

diffstat:

 sys/arch/sh3/include/frame.h   |   6 +-----
 sys/arch/sh3/sh3/genassym.cf   |   4 +---
 sys/arch/sh3/sh3/locore_subr.S |  22 +++++++++++++---------
 sys/arch/sh3/sh3/sh3_machdep.c |  12 +++++-------
 4 files changed, 20 insertions(+), 24 deletions(-)

diffs (111 lines):

diff -r d9ff84965c3e -r ff06a1a76bd4 sys/arch/sh3/include/frame.h
--- a/sys/arch/sh3/include/frame.h      Sun Jun 23 17:47:45 2002 +0000
+++ b/sys/arch/sh3/include/frame.h      Sun Jun 23 18:35:05 2002 +0000
@@ -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 @@
  * Signal frame
  */
 struct sigframe {
-       int     sf_signum;
-       int     sf_code;
-       struct  sigcontext *sf_scp;
-       sig_t   sf_handler;
        struct  sigcontext sf_sc;
 };
 
diff -r d9ff84965c3e -r ff06a1a76bd4 sys/arch/sh3/sh3/genassym.cf
--- a/sys/arch/sh3/sh3/genassym.cf      Sun Jun 23 17:47:45 2002 +0000
+++ b/sys/arch/sh3/sh3/genassym.cf      Sun Jun 23 18:35:05 2002 +0000
@@ -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_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.
diff -r d9ff84965c3e -r ff06a1a76bd4 sys/arch/sh3/sh3/locore_subr.S
--- a/sys/arch/sh3/sh3/locore_subr.S    Sun Jun 23 17:47:45 2002 +0000
+++ b/sys/arch/sh3/sh3/locore_subr.S    Sun Jun 23 18:35:05 2002 +0000
@@ -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 @@
 /*
  * 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
diff -r d9ff84965c3e -r ff06a1a76bd4 sys/arch/sh3/sh3/sh3_machdep.c
--- a/sys/arch/sh3/sh3/sh3_machdep.c    Sun Jun 23 17:47:45 2002 +0000
+++ b/sys/arch/sh3/sh3/sh3_machdep.c    Sun Jun 23 18:35:05 2002 +0000
@@ -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 @@
                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 @@
        /*
         * 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;
 



Home | Main Index | Thread Index | Old Index