summaryrefslogtreecommitdiff
path: root/sys/arch/mvme68k
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-01-27 22:48:43 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-01-27 22:48:43 +0000
commitfd6845b3865eba2ad5058edac543ef9f8f78f4cd (patch)
treea15f16c19bc0208c3d48750757cc0612706331e7 /sys/arch/mvme68k
parentfd600a4e9c7470f397abf3164bef81cc24d75ce9 (diff)
add another parameter to trapsignal() and sendsig() -- fault addr to be
delivered with in the siginfo information
Diffstat (limited to 'sys/arch/mvme68k')
-rw-r--r--sys/arch/mvme68k/mvme68k/machdep.c96
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c11
2 files changed, 100 insertions, 7 deletions
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c
index 57fec537bcf..46a1d3dfac8 100644
--- a/sys/arch/mvme68k/mvme68k/machdep.c
+++ b/sys/arch/mvme68k/mvme68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.13 1997/01/16 20:43:38 kstailey Exp $ */
+/* $OpenBSD: machdep.c,v 1.14 1997/01/27 22:48:16 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -633,9 +633,11 @@ struct sigframe {
int sf_signum; /* signo for handler */
int sf_code; /* additional info for handler */
struct sigcontext *sf_scp; /* context ptr for handler */
+ siginfo_t *sf_sip;
sig_t sf_handler; /* handler addr for u_sigc */
struct sigstate sf_state; /* state of the hardware */
struct sigcontext sf_sc; /* actual context */
+ siginfo_t sf_si;
};
#ifdef COMPAT_HPUX
@@ -680,10 +682,11 @@ int sigpid = 0;
* Send an interrupt to process.
*/
void
-sendsig(catcher, sig, mask, code)
+sendsig(catcher, sig, mask, code, addr)
sig_t catcher;
int sig, mask;
u_long code;
+ caddr_t addr;
{
register struct proc *p = curproc;
register struct sigframe *fp, *kfp;
@@ -749,6 +752,8 @@ sendsig(catcher, sig, mask, code)
kfp->sf_code = code;
kfp->sf_scp = &fp->sf_sc;
kfp->sf_handler = catcher;
+ kfp->sf_sip = NULL;
+
/*
* Save necessary hardware state. Currently this includes:
* - general registers
@@ -806,6 +811,22 @@ sendsig(catcher, sig, mask, code)
kfp->sf_sc.sc_ap = (int)&fp->sf_state;
kfp->sf_sc.sc_pc = frame->f_pc;
kfp->sf_sc.sc_ps = frame->f_sr;
+
+ 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
+ }
+ }
+
#ifdef COMPAT_HPUX
/*
* Create an HP-UX style sigcontext structure and associated goo
@@ -1035,6 +1056,77 @@ 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 05ee76df038..2b139bfbfd1 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.8 1996/12/24 20:29:02 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.9 1997/01/27 22:48:17 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, faultaddr);
+ trapsignal(p, sig, T_MMUFLT, (caddr_t)faultaddr);
goto again;
}
}
@@ -310,7 +310,7 @@ copyfault:
case T_BUSERR|T_USER: /* bus error */
case T_ADDRERR|T_USER: /* address error */
- ucode = v;
+ ucode = code & ~T_USER;
i = SIGBUS;
break;
@@ -610,12 +610,13 @@ copyfault:
type, code);
goto dopanic;
}
- ucode = v;
+ frame.f_pad = code & 0xffff;
+ ucode = T_MMUFLT;
i = SIGSEGV;
break;
}
}
- trapsignal(p, i, ucode);
+ trapsignal(p, i, ucode, (caddr_t)v);
if ((type & T_USER) == 0)
return;
out: