diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-01 21:54:08 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-01 21:54:08 +0000 |
commit | 41af40fac6714670ff497a0558dab724ca56f35f (patch) | |
tree | fa27bd7da1f943755dc82eeb7ecbf9a3b1d955be /sys | |
parent | d1f9e6798948ca75d128ad46760c3788f01d0375 (diff) |
add type & union sigval args to sendsig/trapsignal
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/i386/freebsd_machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/i386/linux_machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 95 | ||||
-rw-r--r-- | sys/arch/i386/i386/svr4_machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/i386/i386/trap.c | 32 | ||||
-rw-r--r-- | sys/arch/i386/i386/vm86.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/freebsd_machdep.h | 2 | ||||
-rw-r--r-- | sys/arch/i386/include/linux_machdep.h | 2 | ||||
-rw-r--r-- | sys/arch/i386/include/svr4_machdep.h | 2 | ||||
-rw-r--r-- | sys/arch/i386/isa/npx.c | 2 |
10 files changed, 54 insertions, 113 deletions
diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c index a27a24630ef..48b9381fc52 100644 --- a/sys/arch/i386/i386/freebsd_machdep.c +++ b/sys/arch/i386/i386/freebsd_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_machdep.c,v 1.8 1997/01/27 22:47:57 deraadt Exp $ */ +/* $OpenBSD: freebsd_machdep.c,v 1.9 1997/02/01 21:53:18 deraadt Exp $ */ /* $NetBSD: freebsd_machdep.c,v 1.10 1996/05/03 19:42:05 christos Exp $ */ /*- @@ -76,11 +76,12 @@ * specified pc, psl. */ void -freebsd_sendsig(catcher, sig, mask, code, addr) +freebsd_sendsig(catcher, sig, mask, code, type, val) sig_t catcher; int sig, mask; u_long code; - caddr_t addr; + int type; + union sigval val; { register struct proc *p = curproc; register struct trapframe *tf; diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c index 52d9bcd578a..4b6e195cf98 100644 --- a/sys/arch/i386/i386/linux_machdep.c +++ b/sys/arch/i386/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_machdep.c,v 1.9 1997/01/27 22:47:58 deraadt Exp $ */ +/* $OpenBSD: linux_machdep.c,v 1.10 1997/02/01 21:53:20 deraadt Exp $ */ /* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */ /* @@ -104,11 +104,12 @@ int linux_write_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *, */ void -linux_sendsig(catcher, sig, mask, code, addr) +linux_sendsig(catcher, sig, mask, code, type, val) sig_t catcher; int sig, mask; u_long code; - caddr_t addr; + int type; + union sigval val; { register struct proc *p = curproc; register struct trapframe *tf; diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 51ab4809612..aff31758dff 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.38 1997/02/01 00:58:25 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.39 1997/02/01 21:53:23 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */ /*- @@ -570,18 +570,19 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) } #ifdef COMPAT_IBCS2 -void ibcs2_sendsig __P((sig_t, int, int, u_long, caddr_t)); +void ibcs2_sendsig __P((sig_t, int, int, u_long, int, union sigval)); void -ibcs2_sendsig(catcher, sig, mask, code, addr) +ibcs2_sendsig(catcher, sig, mask, code, type, val) sig_t catcher; int sig, mask; u_long code; - caddr_t addr; + int type; + union sigval val; { extern int bsd_to_ibcs2_sig[]; - sendsig(catcher, bsd_to_ibcs2_sig[sig], mask, code, addr); + sendsig(catcher, bsd_to_ibcs2_sig[sig], mask, code, type, val); } #endif @@ -596,11 +597,12 @@ ibcs2_sendsig(catcher, sig, mask, code, addr) * specified pc, psl. */ void -sendsig(catcher, sig, mask, code, addr) +sendsig(catcher, sig, mask, code, type, val) sig_t catcher; int sig, mask; u_long code; - caddr_t addr; + int type; + union sigval val; { register struct proc *p = curproc; register struct trapframe *tf; @@ -671,15 +673,7 @@ sendsig(catcher, sig, mask, code, addr) if (psp->ps_siginfo & sigmask(sig)) { frame.sf_sip = &fp->sf_si; - initsiginfo(frame.sf_sip, sig); - fixsiginfo(frame.sf_sip, sig, code, addr); - if (sig == SIGSEGV) { - /* try to be more specific about read or write */ - if (tf->tf_err & PGEX_W) - frame.sf_si.si_code = SEGV_ACCERR; - else - frame.sf_si.si_code = SEGV_MAPERR; - } + initsiginfo(frame.sf_sip, sig, code, type, val); } /* XXX don't copyout siginfo if not needed? */ @@ -788,75 +782,6 @@ sys_sigreturn(p, v, retval) return (EJUSTRETURN); } -void -fixsiginfo(si, sig, code, addr) - siginfo_t *si; - int sig; - u_long code; - caddr_t addr; -{ - si->si_addr = addr; - - switch (code) { - case T_PRIVINFLT: - si->si_code = ILL_PRVOPC; - si->si_trapno = T_PRIVINFLT; - break; - case T_BPTFLT: - si->si_code = TRAP_BRKPT; - si->si_trapno = T_BPTFLT; - break; - case T_ARITHTRAP: - si->si_code = FPE_INTOVF; - si->si_trapno = T_DIVIDE; - break; - case T_PROTFLT: - si->si_code = SEGV_ACCERR; - si->si_trapno = T_PROTFLT; - break; - case T_TRCTRAP: - si->si_code = TRAP_TRACE; - si->si_trapno = T_TRCTRAP; - break; - case T_PAGEFLT: - si->si_code = SEGV_ACCERR; - si->si_trapno = T_PAGEFLT; - break; - case T_ALIGNFLT: - si->si_code = BUS_ADRALN; - si->si_trapno = T_ALIGNFLT; - break; - case T_DIVIDE: - si->si_code = FPE_FLTDIV; - si->si_trapno = T_DIVIDE; - break; - case T_OFLOW: - si->si_code = FPE_FLTOVF; - si->si_trapno = T_DIVIDE; - break; - case T_BOUND: - si->si_code = FPE_FLTSUB; - si->si_trapno = T_BOUND; - break; - case T_DNA: - si->si_code = FPE_FLTINV; - si->si_trapno = T_DNA; - break; - case T_FPOPFLT: - si->si_code = FPE_FLTINV; - si->si_trapno = T_FPOPFLT; - break; - case T_SEGNPFLT: - si->si_code = SEGV_MAPERR; - si->si_trapno = T_SEGNPFLT; - break; - case T_STKFLT: - si->si_code = ILL_BADSTK; - si->si_trapno = T_STKFLT; - break; - } -} - int waittime = -1; struct pcb dumppcb; diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c index 1d3a1c241bd..0bdfcf9c2c8 100644 --- a/sys/arch/i386/i386/svr4_machdep.c +++ b/sys/arch/i386/i386/svr4_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_machdep.c,v 1.9 1997/01/27 22:48:00 deraadt Exp $ */ +/* $OpenBSD: svr4_machdep.c,v 1.10 1997/02/01 21:53:26 deraadt Exp $ */ /* $NetBSD: svr4_machdep.c,v 1.24 1996/05/03 19:42:26 christos Exp $ */ /* @@ -56,7 +56,7 @@ #include <machine/vm86.h> #include <machine/svr4_machdep.h> -static void svr4_getsiginfo __P((union svr4_siginfo *, int, u_long, caddr_t)); +static void svr4_getsiginfo __P((union svr4_siginfo *, int, u_long, int, caddr_t)); void svr4_getcontext(p, uc, mask, oonstack) @@ -212,10 +212,11 @@ svr4_setcontext(p, uc) static void -svr4_getsiginfo(si, sig, code, addr) +svr4_getsiginfo(si, sig, code, type, addr) union svr4_siginfo *si; int sig; u_long code; + int type; caddr_t addr; { si->svr4_si_signo = bsd_to_svr4_sig[sig]; @@ -315,11 +316,12 @@ svr4_getsiginfo(si, sig, code, addr) * will return to the user pc, psl. */ void -svr4_sendsig(catcher, sig, mask, code, addr) +svr4_sendsig(catcher, sig, mask, code, type, val) sig_t catcher; int sig, mask; u_long code; - caddr_t addr; + int type; + union sigval val; { register struct proc *p = curproc; register struct trapframe *tf; @@ -354,7 +356,7 @@ svr4_sendsig(catcher, sig, mask, code, addr) */ svr4_getcontext(p, &frame.sf_uc, mask, oonstack); - svr4_getsiginfo(&frame.sf_si, sig, code, addr); + svr4_getsiginfo(&frame.sf_si, sig, code, type, val.sival_ptr); frame.sf_signum = frame.sf_si.svr4_si_signo; frame.sf_sip = &fp->sf_si; diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 2d90e9b7911..1d52f0da160 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.14 1997/01/27 22:48:01 deraadt Exp $ */ +/* $OpenBSD: trap.c,v 1.15 1997/02/01 21:53:29 deraadt Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ #undef DEBUG @@ -281,17 +281,23 @@ trap(frame) } #endif case T_SEGNPFLT|T_USER: + trapsignal(p, SIGSEGV, type &~ T_USER, SEGV_MAPERR, (caddr_t)rcr2()); + goto out; + case T_STKFLT|T_USER: - trapsignal(p, SIGSEGV, type &~ T_USER, (caddr_t)rcr2()); + trapsignal(p, SIGSEGV, type &~ T_USER, ILL_BADSTK, (caddr_t)rcr2()); goto out; case T_ALIGNFLT|T_USER: - trapsignal(p, SIGBUS, type &~ T_USER, (caddr_t)rcr2()); + trapsignal(p, SIGBUS, type &~ T_USER, BUS_ADRALN, (caddr_t)rcr2()); goto out; case T_PRIVINFLT|T_USER: /* privileged instruction fault */ + trapsignal(p, SIGILL, type &~ T_USER, ILL_PRVOPC, (caddr_t)rcr2()); + goto out; + case T_FPOPFLT|T_USER: /* coprocessor operand fault */ - trapsignal(p, SIGILL, type &~ T_USER, (caddr_t)rcr2()); + trapsignal(p, SIGILL, type &~ T_USER, FPE_FLTINV, (caddr_t)rcr2()); goto out; case T_ASTFLT|T_USER: /* Allow process switch */ @@ -310,24 +316,28 @@ trap(frame) goto trace; return; } - trapsignal(p, rv, type &~ T_USER, (caddr_t)rcr2()); + trapsignal(p, rv, type &~ T_USER, FPE_FLTINV, (caddr_t)rcr2()); goto out; #else printf("pid %d killed due to lack of floating point\n", p->p_pid); - trapsignal(p, SIGKILL, type &~ T_USER, (caddr_t)rcr2()); + trapsignal(p, SIGKILL, type &~ T_USER, FPE_FLTINV, (caddr_t)rcr2()); goto out; #endif } case T_BOUND|T_USER: + trapsignal(p, SIGFPE, type &~ T_USER, FPE_FLTSUB, (caddr_t)rcr2()); + goto out; case T_OFLOW|T_USER: + trapsignal(p, SIGFPE, type &~ T_USER, FPE_FLTOVF, (caddr_t)rcr2()); + goto out; case T_DIVIDE|T_USER: - trapsignal(p, SIGFPE, type &~ T_USER, (caddr_t)rcr2()); + trapsignal(p, SIGFPE, type &~ T_USER, FPE_FLTDIV, (caddr_t)rcr2()); goto out; case T_ARITHTRAP|T_USER: - trapsignal(p, SIGFPE, frame.tf_err, (caddr_t)rcr2()); + trapsignal(p, SIGFPE, frame.tf_err, FPE_INTOVF, (caddr_t)rcr2()); goto out; case T_PAGEFLT: /* allow page faults in kernel mode */ @@ -427,7 +437,7 @@ trap(frame) map, va, ftype, rv); goto we_re_toast; } - trapsignal(p, SIGSEGV, T_PAGEFLT, vv); + trapsignal(p, SIGSEGV, T_PAGEFLT, SEGV_ACCERR, vv); break; } @@ -439,11 +449,13 @@ trap(frame) #endif case T_BPTFLT|T_USER: /* bpt instruction fault */ + trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_BRKPT, (caddr_t)rcr2()); + break; case T_TRCTRAP|T_USER: /* trace trap */ #if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) trace: #endif - trapsignal(p, SIGTRAP, type &~ T_USER, (caddr_t)rcr2()); + trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_TRACE, (caddr_t)rcr2()); break; #include "isa.h" diff --git a/sys/arch/i386/i386/vm86.c b/sys/arch/i386/i386/vm86.c index ba61d16555b..8fd4467e48c 100644 --- a/sys/arch/i386/i386/vm86.c +++ b/sys/arch/i386/i386/vm86.c @@ -253,7 +253,7 @@ vm86_return(p, retval) sigexit(p, SIGILL); /* NOTREACHED */ } - trapsignal(p, SIGURG, retval, 0); + trapsignal(p, SIGURG, retval, 0, 0); } #define CLI 0xFA @@ -369,7 +369,7 @@ vm86_gpfault(p, type) } if (trace && tf->tf_eflags & PSL_VM) - trapsignal(p, SIGTRAP, T_TRCTRAP, 0); + trapsignal(p, SIGTRAP, T_TRCTRAP, TRAP_TRACE, 0); return; bad: diff --git a/sys/arch/i386/include/freebsd_machdep.h b/sys/arch/i386/include/freebsd_machdep.h index 7ee92189afd..e9fd2cf977e 100644 --- a/sys/arch/i386/include/freebsd_machdep.h +++ b/sys/arch/i386/include/freebsd_machdep.h @@ -157,6 +157,6 @@ struct freebsd_ptrace_reg { /* sys/i386/include/exec.h */ #define FREEBSD___LDPGSZ 4096 -void freebsd_sendsig __P((sig_t, int, int, u_long, caddr_t)); +void freebsd_sendsig __P((sig_t, int, int, u_long, int, union sigval)); #endif /* _FREEBSD_MACHDEP_H */ diff --git a/sys/arch/i386/include/linux_machdep.h b/sys/arch/i386/include/linux_machdep.h index c5a09d1cc93..453593beee6 100644 --- a/sys/arch/i386/include/linux_machdep.h +++ b/sys/arch/i386/include/linux_machdep.h @@ -76,7 +76,7 @@ struct linux_sigframe { sig_t sf_handler; }; -void linux_sendsig __P((sig_t, int, int, u_long, caddr_t)); +void linux_sendsig __P((sig_t, int, int, u_long, int, union sigval)); dev_t linux_fakedev __P((dev_t)); /* diff --git a/sys/arch/i386/include/svr4_machdep.h b/sys/arch/i386/include/svr4_machdep.h index fd39dd6c121..13bbdb27419 100644 --- a/sys/arch/i386/include/svr4_machdep.h +++ b/sys/arch/i386/include/svr4_machdep.h @@ -71,7 +71,7 @@ struct svr4_ucontext; void svr4_getcontext __P((struct proc *, struct svr4_ucontext *, int, int)); int svr4_setcontext __P((struct proc *p, struct svr4_ucontext *)); -void svr4_sendsig __P((sig_t, int, int, u_long, caddr_t)); +void svr4_sendsig __P((sig_t, int, int, u_long, int, union sigval)); typedef struct { svr4_gregset_t greg; diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index 6774126fd5b..683332aeb9a 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -448,7 +448,7 @@ npxintr(arg) #else code = 0; /* XXX */ #endif - trapsignal(p, SIGFPE, code, 0); + trapsignal(p, SIGFPE, code, 0, 0); /* XXX type? */ } else { /* * Nested interrupt. These losers occur when: |