summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-02-02 00:43:22 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-02-02 00:43:22 +0000
commitc05aeffe1cb18640342a01eaa8dab096b2943a68 (patch)
tree1f1b31273282ec7b01d8bb80ad6b0f8b74027315
parent7c8697480dc95c84ade4b9cdc95fe7fc87d43504 (diff)
trapsignal/sendsig type/sigval changes
-rw-r--r--sys/arch/mvme68k/mvme68k/machdep.c90
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c30
2 files changed, 30 insertions, 90 deletions
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c
index 93df1dab2d8..9d0f21406f0 100644
--- a/sys/arch/mvme68k/mvme68k/machdep.c
+++ b/sys/arch/mvme68k/mvme68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.15 1997/01/28 09:01:31 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.16 1997/02/02 00:43:20 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -683,11 +683,12 @@ int sigpid = 0;
* Send an interrupt to process.
*/
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 sigframe *fp, *kfp;
@@ -815,17 +816,7 @@ sendsig(catcher, sig, mask, code, addr)
if (psp->ps_siginfo & sigmask(sig)) {
kfp->sf_sip = &kfp->sf_si;
- initsiginfo(kfp->sf_sip, sig);
- fixsiginfo(kfp->sf_sip, sig, code, addr);
- if (sig == SIGSEGV) {
- /* try to be more specific about read or write */
-#if 0
- if (WRFAULT(frame->f_pad))
- kfp->sf_si.si_code |= SEGV_ACCERR;
- else
- kfp->sf_si.si_code |= SEGV_MAPERR;
-#endif
- }
+ initsiginfo(kfp->sf_sip, sig, code, type, val);
}
#ifdef COMPAT_HPUX
@@ -1057,77 +1048,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) {
-#if 0
- case T_PRIVINFLT:
- si->si_code = ILL_PRVOPC;
- si->si_trapno = T_PRIVINFLT;
- break;
- case T_BREAKPOINT:
- si->si_code = TRAP_BRKPT;
- si->si_trapno = T_BREAKPOINT;
- 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;
-#endif
- }
-}
-
int waittime = -1;
static struct haltvec *halts;
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
index 2b139bfbfd1..ea2ddbd2c43 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.9 1997/01/27 22:48:17 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.10 1997/02/02 00:43:21 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -237,7 +237,7 @@ again:
} else if (sig = writeback(fp, fromtrap)) {
beenhere = 1;
oticks = p->p_sticks;
- trapsignal(p, sig, T_MMUFLT, (caddr_t)faultaddr);
+ trapsignal(p, sig, T_MMUFLT, SEGV_MAPERR, (caddr_t)faultaddr);
goto again;
}
}
@@ -262,10 +262,10 @@ trap(type, code, v, frame)
register int i;
u_int ucode;
u_quad_t sticks;
+ int typ = 0, bit;
#ifdef COMPAT_HPUX
extern struct emul emul_hpux;
#endif
- int bit;
#ifdef COMPAT_SUNOS
extern struct emul emul_sunos;
#endif
@@ -309,7 +309,12 @@ copyfault:
return;
case T_BUSERR|T_USER: /* bus error */
+ typ = BUS_OBJERR;
+ ucode = code & ~T_USER;
+ i = SIGBUS;
+ break;
case T_ADDRERR|T_USER: /* address error */
+ typ = BUS_ADRALN;
ucode = code & ~T_USER;
i = SIGBUS;
break;
@@ -333,11 +338,13 @@ copyfault:
p->p_sigmask &= ~i;
i = SIGILL;
ucode = frame.f_format; /* XXX was ILL_RESAD_FAULT */
+ typ = ILL_COPROC;
break;
#ifdef FPCOPROC
case T_COPERR|T_USER: /* user coprocessor violation */
/* What is a proper response here? */
+ typ = FPE_FLTINV;
ucode = 0;
i = SIGFPE;
break;
@@ -352,6 +359,7 @@ copyfault:
* 3 bits of the status register are defined as 0 so there is
* no clash.
*/
+ typ = FPE_FLTRES;
ucode = code;
i = SIGFPE;
break;
@@ -366,6 +374,7 @@ copyfault:
frame.f_format == 2 ? "instruction" : "data type",
frame.f_pc, frame.f_fmt2.f_iaddr);
/* XXX need to FRESTORE */
+ typ = FPE_FLTINV;
i = SIGFPE;
break;
#endif
@@ -373,12 +382,16 @@ copyfault:
case T_ILLINST|T_USER: /* illegal instruction fault */
#ifdef COMPAT_HPUX
if (p->p_emul == &emul_hpux) {
+ typ = 0;
ucode = HPUX_ILL_ILLINST_TRAP;
i = SIGILL;
break;
}
- /* fall through */
#endif
+ ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
+ typ = ILL_ILLOPC;
+ i = SIGILL;
+ break;
case T_PRIVINST|T_USER: /* privileged instruction fault */
#ifdef COMPAT_HPUX
if (p->p_emul == &emul_hpux)
@@ -386,6 +399,7 @@ copyfault:
else
#endif
ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
+ typ = ILL_PRVOPC;
i = SIGILL;
break;
@@ -396,6 +410,7 @@ copyfault:
else
#endif
ucode = frame.f_format; /* XXX was FPE_INTDIV_TRAP */
+ typ = FPE_INTDIV;
i = SIGFPE;
break;
@@ -409,6 +424,7 @@ copyfault:
}
#endif
ucode = frame.f_format; /* XXX was FPE_SUBRNG_TRAP */
+ typ = FPE_FLTSUB;
i = SIGFPE;
break;
@@ -422,6 +438,7 @@ copyfault:
}
#endif
ucode = frame.f_format; /* XXX was FPE_INTOVF_TRAP */
+ typ = FPE_FLTOVF;
i = SIGFPE;
break;
@@ -445,6 +462,7 @@ copyfault:
#endif
frame.f_sr &= ~PSL_T;
i = SIGTRAP;
+ typ = TRAP_TRACE;
break;
case T_TRACE|T_USER: /* user trace trap */
@@ -463,6 +481,7 @@ copyfault:
#endif
frame.f_sr &= ~PSL_T;
i = SIGTRAP;
+ typ = TRAP_TRACE;
break;
case T_ASTFLT: /* system async trap, cannot happen */
@@ -612,11 +631,12 @@ copyfault:
}
frame.f_pad = code & 0xffff;
ucode = T_MMUFLT;
+ typ = SEGV_MAPERR;
i = SIGSEGV;
break;
}
}
- trapsignal(p, i, ucode, (caddr_t)v);
+ trapsignal(p, i, ucode, typ, (caddr_t)v);
if ((type & T_USER) == 0)
return;
out: