Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm When delivering a signal, there is no need to p...



details:   https://anonhg.NetBSD.org/src/rev/32e448dc9fd5
branches:  trunk
changeset: 533157:32e448dc9fd5
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 23 00:16:20 2002 +0000

description:
When delivering a signal, there is no need to push the signal number,
code, context pointer, or handler onto the stack, so don't do so.

diffstat:

 sys/arch/arm/arm/sig_machdep.c |  18 ++++++------------
 sys/arch/arm/arm/sigcode.S     |  14 +++++++++-----
 sys/arch/arm/include/frame.h   |   6 +-----
 3 files changed, 16 insertions(+), 22 deletions(-)

diffs (108 lines):

diff -r 9101b2f4167c -r 32e448dc9fd5 sys/arch/arm/arm/sig_machdep.c
--- a/sys/arch/arm/arm/sig_machdep.c    Sat Jun 22 23:13:37 2002 +0000
+++ b/sys/arch/arm/arm/sig_machdep.c    Sun Jun 23 00:16:20 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sig_machdep.c,v 1.11 2002/03/24 16:10:11 bjh21 Exp $   */
+/*     $NetBSD: sig_machdep.c,v 1.12 2002/06/23 00:16:20 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.11 2002/03/24 16:10:11 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.12 2002/06/23 00:16:20 thorpej Exp $");
 
 #include <sys/mount.h>         /* XXX only needed by syscallargs.h */
 #include <sys/proc.h>
@@ -102,12 +102,6 @@
        fp--;
        (u_int)fp = STACKALIGN(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_r0     = tf->tf_r0;
        frame.sf_sc.sc_r1     = tf->tf_r1;
@@ -156,10 +150,10 @@
        /*
         * Build context to run handler in.
         */
-       tf->tf_r0 = frame.sf_signum;
-       tf->tf_r1 = frame.sf_code;
-       tf->tf_r2 = (int)frame.sf_scp;
-       tf->tf_r3 = (int)frame.sf_handler;
+       tf->tf_r0 = sig;
+       tf->tf_r1 = code;
+       tf->tf_r2 = (int)&fp->sf_sc;
+       tf->tf_r3 = (int)catcher;
        tf->tf_usr_sp = (int)fp;
        tf->tf_pc = (int)p->p_sigctx.ps_sigcode;
 #ifndef acorn26
diff -r 9101b2f4167c -r 32e448dc9fd5 sys/arch/arm/arm/sigcode.S
--- a/sys/arch/arm/arm/sigcode.S        Sat Jun 22 23:13:37 2002 +0000
+++ b/sys/arch/arm/arm/sigcode.S        Sun Jun 23 00:16:20 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sigcode.S,v 1.1 2001/01/13 00:06:50 bjh21 Exp $        */
+/*     $NetBSD: sigcode.S,v 1.2 2002/06/23 00:16:20 thorpej Exp $      */
 
 /*
  * Copyright (C) 1994-1997 Mark Brinicombe
@@ -33,7 +33,7 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: sigcode.S,v 1.1 2001/01/13 00:06:50 bjh21 Exp $")
+RCSID("$NetBSD: sigcode.S,v 1.2 2002/06/23 00:16:20 thorpej Exp $")
 
 #include "assym.h"
 #include <sys/syscall.h>
@@ -46,16 +46,20 @@
 /*
  * r0-r2 are our signal handler parameters
  * r3 is the handler address
+ *
+ * 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: Don't use SIG_SCP as this make have been trashed by the program
+ * 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).
  */
-       add     r0, sp, #SIGF_SC
+       mov     r0, sp
        swi     SYS___sigreturn14
 
 /* Well if that failed we better exit quick ! */
diff -r 9101b2f4167c -r 32e448dc9fd5 sys/arch/arm/include/frame.h
--- a/sys/arch/arm/include/frame.h      Sat Jun 22 23:13:37 2002 +0000
+++ b/sys/arch/arm/include/frame.h      Sun Jun 23 00:16:20 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frame.h,v 1.3 2001/08/31 04:44:55 simonb Exp $ */
+/*     $NetBSD: frame.h,v 1.4 2002/06/23 00:16:21 thorpej Exp $        */
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -81,10 +81,6 @@
  */
 
 struct sigframe {
-       int     sf_signum;
-       int     sf_code;
-       struct  sigcontext *sf_scp;
-       sig_t   sf_handler;
        struct  sigcontext sf_sc;
 };
 



Home | Main Index | Thread Index | Old Index