-/* $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 $ */
/*-
* 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;
-/* $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 $ */
/*
*/
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;
-/* $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 $ */
/*-
}
#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
* 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;
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? */
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;
-/* $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 $ */
/*
#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)
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];
* 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;
*/
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;
-/* $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
}
#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 */
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 */
map, va, ftype, rv);
goto we_re_toast;
}
- trapsignal(p, SIGSEGV, T_PAGEFLT, vv);
+ trapsignal(p, SIGSEGV, T_PAGEFLT, SEGV_ACCERR, vv);
break;
}
#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"
sigexit(p, SIGILL);
/* NOTREACHED */
}
- trapsignal(p, SIGURG, retval, 0);
+ trapsignal(p, SIGURG, retval, 0, 0);
}
#define CLI 0xFA
}
if (trace && tf->tf_eflags & PSL_VM)
- trapsignal(p, SIGTRAP, T_TRCTRAP, 0);
+ trapsignal(p, SIGTRAP, T_TRCTRAP, TRAP_TRACE, 0);
return;
bad:
/* 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 */
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));
/*
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;
#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:
-/* $OpenBSD: ibcs2_exec.c,v 1.6 1997/01/27 22:48:30 deraadt Exp $ */
+/* $OpenBSD: ibcs2_exec.c,v 1.7 1997/02/01 21:49:48 deraadt Exp $ */
/* $NetBSD: ibcs2_exec.c,v 1.12 1996/10/12 02:13:52 thorpej Exp $ */
/*
extern int bsd2ibcs_errno[];
extern struct sysent ibcs2_sysent[];
extern char *ibcs2_syscallnames[];
-extern void ibcs2_sendsig __P((sig_t, int, int, u_long, caddr_t));
+extern void ibcs2_sendsig __P((sig_t, int, int, u_long, int, union sigval));
extern char sigcode[], esigcode[];
const char ibcs2_emul_path[] = "/emul/ibcs2";
-/* $OpenBSD: sunos.h,v 1.5 1997/01/27 22:48:33 deraadt Exp $ */
+/* $OpenBSD: sunos.h,v 1.6 1997/02/01 21:49:53 deraadt Exp $ */
/* $NetBSD: sunos.h,v 1.8 1996/05/05 16:07:43 veego Exp $ */
#define SUNM_RDONLY 0x01 /* mount fs read-only */
__BEGIN_DECLS
/* Defined in arch/m68k/m68k/sunos_machdep.c -- sparc uses regular sendsig() */
#ifndef sparc
-void sunos_sendsig __P((sig_t, int, int, u_long, caddr_t));
+void sunos_sendsig __P((sig_t, int, int, u_long, int, union sigval));
#endif
__END_DECLS
-/* $OpenBSD: kern_sig.c,v 1.15 1997/01/27 22:48:36 deraadt Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.16 1997/02/01 21:49:41 deraadt Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
* Otherwise, post it normally.
*/
void
-trapsignal(p, signum, code, addr)
+trapsignal(p, signum, code, type, sigval)
struct proc *p;
register int signum;
u_long code;
- caddr_t addr;
+ int type;
+ union sigval sigval;
{
register struct sigacts *ps = p->p_sigacts;
int mask;
p->p_sigmask, code);
#endif
(*p->p_emul->e_sendsig)(ps->ps_sigact[signum], signum,
- p->p_sigmask, code, addr);
+ p->p_sigmask, code, type, sigval);
p->p_sigmask |= ps->ps_catchmask[signum];
if ((ps->ps_sigreset & mask) != 0) {
p->p_sigcatch &= ~mask;
code = ps->ps_code;
ps->ps_code = 0;
}
- (*p->p_emul->e_sendsig)(action, signum, returnmask, code, 0);
+ (*p->p_emul->e_sendsig)(action, signum, returnmask, code,
+ SI_USER, (union sigval *)0);
}
}
}
void
-initsiginfo(si, sig)
+initsiginfo(si, sig, code, type, val)
siginfo_t *si;
int sig;
+ u_long code;
+ int type;
+ union sigval val;
{
bzero(si, sizeof *si);
+
si->si_signo = sig;
- si->si_addr = (caddr_t)-1;
+ si->si_code = type;
+ if (type == SI_USER) {
+ si->si_value = val;
+ } else {
+ switch (sig) {
+ case SIGSEGV:
+ case SIGILL:
+ case SIGBUS:
+ case SIGFPE:
+ si->si_addr = val.sival_ptr;
+ si->si_trapno = code;
+ break;
+ case SIGXFSZ:
+ break;
+ }
+ }
}
-/* $OpenBSD: proc.h,v 1.12 1997/01/27 22:48:41 deraadt Exp $ */
+/* $OpenBSD: proc.h,v 1.13 1997/02/01 21:49:30 deraadt Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
*/
struct exec_package;
struct ps_strings;
+union sigval;
struct emul {
char e_name[8]; /* Symbolic name */
int *e_errno; /* Errno array */
/* Signal sending function */
- void (*e_sendsig) __P((sig_t, int, int, u_long, caddr_t));
+ void (*e_sendsig) __P((sig_t, int, int, u_long, int, union sigval));
int e_nosys; /* Offset of the nosys() syscall */
int e_nsysent; /* Number of system call entries */
struct sysent *e_sysent; /* System call array */
-/* $OpenBSD: siginfo.h,v 1.3 1997/01/27 23:21:22 deraadt Exp $ */
+/* $OpenBSD: siginfo.h,v 1.4 1997/02/01 21:49:34 deraadt Exp $ */
/*
* Copyright (c) 1997 Theo de Raadt
#define si_mstate _data._prof._mstate
#if defined(_KERNEL)
-void initsiginfo __P((siginfo_t *, int));
-void fixsiginfo __P((siginfo_t *, int, u_long, caddr_t));
+void initsiginfo __P((siginfo_t *, int, u_long, int, union sigval));
#endif
#endif /* _SYS_SIGINFO_H */
-/* $OpenBSD: signalvar.h,v 1.5 1997/01/27 22:48:42 deraadt Exp $ */
+/* $OpenBSD: signalvar.h,v 1.6 1997/02/01 21:49:36 deraadt Exp $ */
/* $NetBSD: signalvar.h,v 1.17 1996/04/22 01:23:31 christos Exp $ */
/*
void postsig __P((int sig));
void psignal __P((struct proc *p, int sig));
void siginit __P((struct proc *p));
-void trapsignal __P((struct proc *p, int sig, u_long code, caddr_t addr));
+void trapsignal __P((struct proc *p, int sig, u_long code, int type,
+ union sigval val));
void sigexit __P((struct proc *, int));
void setsigvec __P((struct proc *, int, struct sigaction *));
int killpg1 __P((struct proc *, int, int, int));
* Machine-dependent functions:
*/
void sendsig __P((sig_t action, int sig, int returnmask, u_long code,
- caddr_t addr));
+ int type, union sigval val));
struct core;
struct vnode;
struct ucred;