Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm When delivering a signal, arrange to have t...



details:   https://anonhg.NetBSD.org/src/rev/f187322fd635
branches:  trunk
changeset: 533171:f187322fd635
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 23 19:16:43 2002 +0000

description:
When delivering a signal, arrange to have the handler invoked directly,
using the trampoline only for the return.  This saves two instructions
in the trampoline, one of them being a branch.

diffstat:

 sys/arch/arm/arm/sig_machdep.c |  11 ++++++-----
 sys/arch/arm/arm/sigcode.S     |  18 ++++--------------
 2 files changed, 10 insertions(+), 19 deletions(-)

diffs (79 lines):

diff -r 11f036786c22 -r f187322fd635 sys/arch/arm/arm/sig_machdep.c
--- a/sys/arch/arm/arm/sig_machdep.c    Sun Jun 23 18:49:33 2002 +0000
+++ b/sys/arch/arm/arm/sig_machdep.c    Sun Jun 23 19:16:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sig_machdep.c,v 1.12 2002/06/23 00:16:20 thorpej Exp $ */
+/*     $NetBSD: sig_machdep.c,v 1.13 2002/06/23 19:16:43 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.12 2002/06/23 00:16:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.13 2002/06/23 19:16:43 thorpej Exp $");
 
 #include <sys/mount.h>         /* XXX only needed by syscallargs.h */
 #include <sys/proc.h>
@@ -148,14 +148,15 @@
        }
 
        /*
-        * Build context to run handler in.
+        * Build context to run handler in.  We invoke the handler
+        * directly, only returning via the trampoline.
         */
        tf->tf_r0 = sig;
        tf->tf_r1 = code;
        tf->tf_r2 = (int)&fp->sf_sc;
-       tf->tf_r3 = (int)catcher;
+       tf->tf_pc = (int)catcher;
        tf->tf_usr_sp = (int)fp;
-       tf->tf_pc = (int)p->p_sigctx.ps_sigcode;
+       tf->tf_usr_lr = (int)p->p_sigctx.ps_sigcode;
 #ifndef acorn26
        /* XXX This should not be needed. */
        cpu_icache_sync_all();
diff -r 11f036786c22 -r f187322fd635 sys/arch/arm/arm/sigcode.S
--- a/sys/arch/arm/arm/sigcode.S        Sun Jun 23 18:49:33 2002 +0000
+++ b/sys/arch/arm/arm/sigcode.S        Sun Jun 23 19:16:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sigcode.S,v 1.2 2002/06/23 00:16:20 thorpej Exp $      */
+/*     $NetBSD: sigcode.S,v 1.3 2002/06/23 19:16:43 thorpej Exp $      */
 
 /*
  * Copyright (C) 1994-1997 Mark Brinicombe
@@ -33,7 +33,7 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: sigcode.S,v 1.2 2002/06/23 00:16:20 thorpej Exp $")
+RCSID("$NetBSD: sigcode.S,v 1.3 2002/06/23 19:16:43 thorpej Exp $")
 
 #include "assym.h"
 #include <sys/syscall.h>
@@ -44,21 +44,11 @@
 
 ENTRY_NP(sigcode)
 /*
- * r0-r2 are our signal handler parameters
- * r3 is the handler address
+ * The kernel arranges for the handler to be invoked directly.  This
+ * trampoline is used only to return from the signal.
  *
  * The stack pointer points to the saved sigcontext.
  */
-
-       add     lr, pc, #0                      /* Set return address */
-       mov     pc, r3                          /* Call the handler */
-
-/*
- * Call sig_return with address of the signal context.  Note the
- * pointer to this may have been clobbered by the handler, so
- * we need to recompute from the stack pointer (which, thankfully,
- * is quite easy).
- */
        mov     r0, sp
        swi     SYS___sigreturn14
 



Home | Main Index | Thread Index | Old Index