diff --git a/sys/arch/powerpc/include/signal.h b/sys/arch/powerpc/include/signal.h index e34fbfb0357c..9d6c9d44a214 100644 --- a/sys/arch/powerpc/include/signal.h +++ b/sys/arch/powerpc/include/signal.h @@ -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 @@ struct sigcontext { 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 --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 9ae9c26958a3..c80330f07e5c 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -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 -__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 @@ sigaction1(struct proc *p, int signum, const struct sigaction *nsa, * trampoline. */ if ((vers != 0 && tramp == NULL) || +#ifdef SIGTRAMP_VALID + !SIGTRAMP_VALID(vers) || +#endif (vers == 0 && tramp != NULL)) return (EINVAL);