Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pc532 During native signal delivery, arrange to hav...



details:   https://anonhg.NetBSD.org/src/rev/91dc556b483d
branches:  trunk
changeset: 533812:91dc556b483d
user:      simonb <simonb%NetBSD.org@localhost>
date:      Tue Jul 09 23:10:03 2002 +0000

description:
During native signal delivery, arrange to have the signal handler invoked
directly, using the trampoline only for the return path.  Saves a jsr and
movqd insn in the trampoline.
Changes gratuitously ripped off the i386 work for same.

diffstat:

 sys/arch/pc532/include/frame.h   |  12 +++++-----
 sys/arch/pc532/pc532/genassym.cf |   5 +---
 sys/arch/pc532/pc532/locore.s    |  12 ++++++----
 sys/arch/pc532/pc532/machdep.c   |  43 ++++++++++++++++++++-------------------
 4 files changed, 36 insertions(+), 36 deletions(-)

diffs (139 lines):

diff -r e94cc8cd970f -r 91dc556b483d sys/arch/pc532/include/frame.h
--- a/sys/arch/pc532/include/frame.h    Tue Jul 09 22:51:13 2002 +0000
+++ b/sys/arch/pc532/include/frame.h    Tue Jul 09 23:10:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frame.h,v 1.7 1998/04/11 17:30:40 matthias Exp $       */
+/*     $NetBSD: frame.h,v 1.8 2002/07/09 23:10:03 simonb Exp $ */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -94,11 +94,11 @@
  * Signal frame
  */
 struct sigframe {
-       int     sf_signum;
-       int     sf_code;
-       struct  sigcontext *sf_scp;
-       sig_t   sf_handler;
-       struct  sigcontext sf_sc;
+       int     sf_ra;                  /* return address for handler */
+       int     sf_signum;              /* "signum" argument for handler */
+       int     sf_code;                /* "code" argument for handler */
+       struct  sigcontext *sf_scp;     /* "scp" argument for handler */
+       struct  sigcontext sf_sc;       /* actual saved context */
 };
 
 #endif /* _NS532_FRAME_H_ */
diff -r e94cc8cd970f -r 91dc556b483d sys/arch/pc532/pc532/genassym.cf
--- a/sys/arch/pc532/pc532/genassym.cf  Tue Jul 09 22:51:13 2002 +0000
+++ b/sys/arch/pc532/pc532/genassym.cf  Tue Jul 09 23:10:03 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.8 2000/06/29 07:51:46 mrg Exp $
+#      $NetBSD: genassym.cf,v 1.9 2002/07/09 23:10:03 simonb Exp $
 
 #
 # Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -98,9 +98,6 @@
 define REGS_SB                 offsetof(struct reg, r_sb)
 define REGS_PSR                offsetof(struct reg, r_psr)
 
-define SIGF_HANDLER            offsetof(struct sigframe, sf_handler)
-define SIGF_SC                 offsetof(struct sigframe, sf_sc)
-
 define IV_VEC                  offsetof(struct iv, iv_vec)
 define IV_ARG                  offsetof(struct iv, iv_arg)
 define IV_CNT                  offsetof(struct iv, iv_cnt)
diff -r e94cc8cd970f -r 91dc556b483d sys/arch/pc532/pc532/locore.s
--- a/sys/arch/pc532/pc532/locore.s     Tue Jul 09 22:51:13 2002 +0000
+++ b/sys/arch/pc532/pc532/locore.s     Tue Jul 09 23:10:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.65 2002/05/28 10:11:26 simonb Exp $       */
+/*     $NetBSD: locore.s,v 1.66 2002/07/09 23:10:04 simonb Exp $       */
 
 /*
  * Copyright (c) 1993 Philip A. Nelson.
@@ -148,10 +148,12 @@
  */
 
 ENTRY_NOPROFILE(sigcode)
-       jsr     0(SIGF_HANDLER(sp))
-       addr    SIGF_SC(sp),tos         /* scp (the call may have clobbered */
-                                       /* the copy at SIGF_SCP(sp)). */
-       movqd   0,tos                   /* Push a fake return address. */
+       /*
+        * Handler has returned here as if we called it.  The sigcontext
+        * is on the stack after the 3 args "we" pushed.
+        */
+       addr    12(sp),4(sp)            /* get pointer to sigcontext
+                                          and put it in the argument slot */
        movd    SYS___sigreturn14,r0
        svc
        movd    0,0                     /* Illegal instruction. */
diff -r e94cc8cd970f -r 91dc556b483d sys/arch/pc532/pc532/machdep.c
--- a/sys/arch/pc532/pc532/machdep.c    Tue Jul 09 22:51:13 2002 +0000
+++ b/sys/arch/pc532/pc532/machdep.c    Tue Jul 09 23:10:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.128 2002/07/04 23:32:06 thorpej Exp $    */
+/*     $NetBSD: machdep.c,v 1.129 2002/07/09 23:10:04 simonb Exp $     */
 
 /*-
  * Copyright (c) 1996 Matthias Pfaller.
@@ -348,10 +348,24 @@
        fp--;
 
        /* Build stack frame for signal trampoline. */
+       switch (ps->sa_sigdesc[sig].sd_vers) {
+#if 1 /* COMPAT_16 */
+       case 0:
+               frame.sf_ra = (int)p->p_sigctx.ps_sigcode;
+               break;
+#endif /* COMPAT_16 */
+
+       case 1:
+               frame.sf_ra = (int)ps->sa_sigdesc[sig].sd_tramp;
+               break;
+
+       default:
+               /* Don't know what trampoline version; kill it. */
+               sigexit(p, SIGILL);
+       }
        frame.sf_signum = sig;
        frame.sf_code = code;
        frame.sf_scp = &fp->sf_sc;
-       frame.sf_handler = catcher;
 
        /* Save the register context. */
        frame.sf_sc.sc_fp = regs->r_fp;
@@ -394,26 +408,13 @@
        }
 
        /*
-        * Build context to run handler in.  Note the trampoline version
-        * numbers are coordinated with machine-dependent code in libc.
+        * Build context to run handler in.  We invoke the handler
+        * directly, only returning via the trampoline.  Note the
+        * trampoline version numbers are coordinated with machine-
+        * dependent code in libc.
         */
-       switch (ps->sa_sigdesc[sig].sd_vers) {
-#if 1 /* COMPAT_16 */
-       case 0:
-               regs->r_sp = (int)fp;
-               regs->r_pc = (int)p->p_sigctx.ps_sigcode;
-               break;
-#endif /* COMPAT_16 */
-
-       case 1:
-               regs->r_sp = (int)fp;
-               regs->r_pc = (int)ps->sa_sigdesc[sig].sd_tramp;
-               break;
-
-       default:
-               /* Don't know what trampoline version; kill it. */
-               sigexit(p, SIGILL);
-       }
+       regs->r_sp = (int)fp;
+       regs->r_pc = (int)catcher;
 
        /* Remember that we're now on the signal stack. */
        if (onstack)



Home | Main Index | Thread Index | Old Index