Source-Changes-HG archive

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

[src/trunk]: src/sys Add a machine-dependent SIGTRAMP_VALID macro which is us...



details:   https://anonhg.NetBSD.org/src/rev/3cecdc5b5738
branches:  trunk
changeset: 552534:3cecdc5b5738
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Sep 26 22:14:19 2003 +0000

description:
Add a machine-dependent SIGTRAMP_VALID macro which is used to test whether
a trampoline version is valid or not.

diffstat:

 sys/arch/powerpc/include/signal.h |  46 ++++++--------------------------------
 sys/kern/kern_sig.c               |   7 ++++-
 2 files changed, 13 insertions(+), 40 deletions(-)

diffs (92 lines):

diff -r 179d8436551c -r 3cecdc5b5738 sys/arch/powerpc/include/signal.h
--- a/sys/arch/powerpc/include/signal.h Fri Sep 26 21:41:16 2003 +0000
+++ b/sys/arch/powerpc/include/signal.h Fri Sep 26 22:14:19 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: signal.h,v 1.14 2003/09/25 22:22:36 matt Exp $ */
+/*     $NetBSD: signal.h,v 1.15 2003/09/26 22:14:19 matt Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -61,47 +61,17 @@
        sigset_t sc_mask;               /* saved signal mask (new style) */
 };
 
-#ifndef __HAVE_SIGINFO
-/*
- * The following macros are used to convert from a ucontext to sigcontext,
- * and vice-versa.  This is for building a sigcontext to deliver to old-style
- * signal handlers, and converting back (in the event the handler modifies
- * the context).
- */
-#define        _MCONTEXT_TO_SIGCONTEXT(uc, sc)                                 \
-do {                                                                   \
-       memcpy((sc)->sc_frame.fixreg, &(uc)->uc_mcontext.__gregs[_REG_R0], \
-           sizeof((sc)->sc_frame.fixreg));                             \
-       (sc)->sc_frame.cr     = (uc)->uc_mcontext.__gregs[_REG_CR];     \
-       (sc)->sc_frame.lr     = (uc)->uc_mcontext.__gregs[_REG_LR];     \
-       (sc)->sc_frame.srr0   = (uc)->uc_mcontext.__gregs[_REG_PC];     \
-       (sc)->sc_frame.srr1   = (uc)->uc_mcontext.__gregs[_REG_MSR];    \
-       (sc)->sc_frame.ctr    = (uc)->uc_mcontext.__gregs[_REG_CTR];    \
-       (sc)->sc_frame.xer    = (uc)->uc_mcontext.__gregs[_REG_XER];    \
-       (sc)->sc_frame.mq     = (uc)->uc_mcontext.__gregs[_REG_MQ];     \
-       (sc)->sc_frame.vrsave = (uc)->uc_mcontext.__vrf.__vrsave;       \
-       (sc)->sc_frame.spare  = 0;                                      \
-} while (/*CONSTCOND*/0)
-
-#define        _SIGCONTEXT_TO_MCONTEXT(sc, uc)                                 \
-do {                                                                   \
-       memcpy(&(uc)->uc_mcontext.__gregs[_REG_R0], (sc)->sc_frame.fixreg, \
-           sizeof((sc)->sc_frame.fixreg));                             \
-       (uc)->uc_mcontext.__gregs[_REG_CR] = (sc)->sc_frame.cr;         \
-       (uc)->uc_mcontext.__gregs[_REG_LR] = (sc)->sc_frame.lr;         \
-       (uc)->uc_mcontext.__gregs[_REG_PC] = (sc)->sc_frame.srr0;       \
-       (uc)->uc_mcontext.__gregs[_REG_MSR] = (sc)->sc_frame.srr1;      \
-       (uc)->uc_mcontext.__gregs[_REG_CTR] = (sc)->sc_frame.ctr;       \
-       (uc)->uc_mcontext.__gregs[_REG_XER] = (sc)->sc_frame.xer;       \
-       (uc)->uc_mcontext.__gregs[_REG_MQ] = (sc)->sc_frame.mq;         \
-       (uc)->uc_mcontext.__vrf.__vrsave  = (sc)->sc_frame.vrsave;      \
-} while (/*CONSTCOND*/0)
-#endif /* !__HAVE_SIGINFO */
-
 #ifdef _KERNEL
 void   sendsig_sigcontext(int, const sigset_t *, u_long);
+
+#ifdef COMPAT_16
+#define        SIGTRAMP_VALID(vers)    ((vers) <= 2)
+#else
+#define        SIGTRAMP_VALID(vers)    ((vers) == 0 && (vers) == 2)
 #endif
 
+#endif /* _KERNEL */
+
 #endif /* _NETBSD_SOURCE */
 #endif /* !_LOCORE */
 #endif /* !_POWERPC_SIGNAL_H_ */
diff -r 179d8436551c -r 3cecdc5b5738 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Fri Sep 26 21:41:16 2003 +0000
+++ b/sys/kern/kern_sig.c       Fri Sep 26 22:14:19 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.160 2003/09/25 21:59:18 christos Exp $  */
+/*     $NetBSD: kern_sig.c,v 1.161 2003/09/26 22:14:19 matt Exp $      */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.160 2003/09/25 21:59:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.161 2003/09/26 22:14:19 matt Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_sunos.h"
@@ -278,6 +278,9 @@
         * trampoline.
         */
        if ((vers != 0 && tramp == NULL) ||
+#ifdef SIGTRAMP_VALID
+           !SIGTRAMP_VALID(vers) ||
+#endif
            (vers == 0 && tramp != NULL))
                return (EINVAL);
 



Home | Main Index | Thread Index | Old Index