summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-02-01 23:05:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-02-01 23:05:10 +0000
commit8b9eebd8494d97b2b02bf5e7a0f2edc7ebe67ca7 (patch)
treefbe34d7c5b2260f82ecd081e95486ee33ed5bece /sys/arch/sparc
parent41af40fac6714670ff497a0558dab724ca56f35f (diff)
trapsignal/sendsig type/sigval changes
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/fpu/fpu.c17
-rw-r--r--sys/arch/sparc/include/svr4_machdep.h2
-rw-r--r--sys/arch/sparc/sparc/machdep.c92
-rw-r--r--sys/arch/sparc/sparc/svr4_machdep.c7
-rw-r--r--sys/arch/sparc/sparc/trap.c26
5 files changed, 37 insertions, 107 deletions
diff --git a/sys/arch/sparc/fpu/fpu.c b/sys/arch/sparc/fpu/fpu.c
index 3b1c8a0dbf9..ea82f000beb 100644
--- a/sys/arch/sparc/fpu/fpu.c
+++ b/sys/arch/sparc/fpu/fpu.c
@@ -89,6 +89,14 @@ static u_char fpu_codes[] = {
X16(FPE_FLTOPERR_TRAP)
};
+static int fpu_types[] = {
+ FPE_FLTRES,
+ FPE_FLTDIV,
+ FPE_FLTUND,
+ FPE_FLTOVF,
+ FPE_FLTINV,
+};
+
/*
* The FPU gave us an exception. Clean up the mess. Note that the
* fp queue can only have FPops in it, never load/store FP registers
@@ -114,7 +122,7 @@ fpu_cleanup(p, fs)
/* XXX missing trap address! */
if ((i = fsr & FSR_CX) == 0)
panic("fpu ieee trap, but no exception");
- trapsignal(p, SIGFPE, fpu_codes[i - 1], 0);
+ trapsignal(p, SIGFPE, fpu_codes[i - 1], fpu_types[i - i], 0);
break; /* XXX should return, but queue remains */
case FSR_TT_UNFIN:
@@ -131,7 +139,7 @@ fpu_cleanup(p, fs)
log(LOG_ERR, "fpu hardware error (%s[%d])\n",
p->p_comm, p->p_pid);
uprintf("%s[%d]: fpu hardware error\n", p->p_comm, p->p_pid);
- trapsignal(p, SIGFPE, -1, 0); /* ??? */
+ trapsignal(p, SIGFPE, -1, FPE_FLTINV, 0); /* ??? */
goto out;
default:
@@ -155,11 +163,12 @@ fpu_cleanup(p, fs)
case FPE:
trapsignal(p, SIGFPE,
- fpu_codes[(fs->fs_fsr & FSR_CX) - 1], 0);
+ fpu_codes[(fs->fs_fsr & FSR_CX) - 1],
+ fpu_types[(fs->fs_fsr & FSR_CX) - 1], 0);
break;
case NOTFPU:
- trapsignal(p, SIGILL, 0, 0); /* ??? code? */
+ trapsignal(p, SIGILL, 0, FPE_FLTINV, 0);
break;
default:
diff --git a/sys/arch/sparc/include/svr4_machdep.h b/sys/arch/sparc/include/svr4_machdep.h
index 2c716b37714..7b1220ee14f 100644
--- a/sys/arch/sparc/include/svr4_machdep.h
+++ b/sys/arch/sparc/include/svr4_machdep.h
@@ -101,7 +101,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));
int svr4_trap __P((int, struct proc *));
#endif /* !_SPARC_SVR4_MACHDEP_H_ */
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index 0db30c9afcd..0e4ba58c863 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -427,7 +427,7 @@ struct sigframe {
int sf_xxx; /* placeholder */
#endif
union {
- int sfu_addr; /* SunOS compat */
+ caddr_t sfu_addr; /* SunOS compat */
siginfo_t *sfu_sip; /* native */
} sf_u;
struct sigcontext sf_sc; /* actual sigcontext */
@@ -463,11 +463,12 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
* 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 sigacts *psp = p->p_sigacts;
@@ -513,7 +514,7 @@ sendsig(catcher, sig, mask, code, addr)
#ifdef COMPAT_SUNOS
if (p->p_emul == &emul_sunos) {
sf.sf_scp = &fp->sf_sc;
- sf.sf_u.sfu_addr = (u_int)addr;
+ sf.sf_u.sfu_addr = val.sival_ptr;
}
#endif
@@ -531,17 +532,7 @@ sendsig(catcher, sig, mask, code, addr)
if (psp->ps_siginfo & sigmask(sig)) {
sf.sf_u.sfu_sip = &fp->sf_si;
- initsiginfo(sf.sf_u.sfu_sip, sig);
- fixsiginfo(sf.sf_u.sfu_sip, sig, code, addr);
-#if 0
- if (sig == SIGSEGV) {
- /* try to be more specific about read or write */
- if (tf->tf_err & PGEX_W)
- sf.sf_si.si_code = SEGV_ACCERR;
- else
- sf.sf_si.si_code = SEGV_MAPERR;
- }
-#endif
+ initsiginfo(sf.sf_u.sfu_sip, sig, code, type, val);
}
/*
@@ -652,77 +643,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;
-
-#if 0
- 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;
- }
-#endif
-}
-
int waittime = -1;
void
diff --git a/sys/arch/sparc/sparc/svr4_machdep.c b/sys/arch/sparc/sparc/svr4_machdep.c
index f36f5991c27..859362405fc 100644
--- a/sys/arch/sparc/sparc/svr4_machdep.c
+++ b/sys/arch/sparc/sparc/svr4_machdep.c
@@ -462,11 +462,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;
@@ -500,7 +501,7 @@ svr4_sendsig(catcher, sig, mask, code, addr)
/*
* Build the argument list for the signal handler.
*/
- svr4_getsiginfo(&frame.sf_si, sig, code, addr);
+ svr4_getsiginfo(&frame.sf_si, sig, code, val.sival_ptr);
svr4_getcontext(p, &frame.sf_uc, mask, oonstack);
frame.sf_signum = frame.sf_si.svr4_si_signo;
frame.sf_sip = &fp->sf_si;
diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c
index a2866f17b3d..19a328d4797 100644
--- a/sys/arch/sparc/sparc/trap.c
+++ b/sys/arch/sparc/sparc/trap.c
@@ -337,7 +337,7 @@ badtrap:
/* ... but leave it in until we find anything */
printf("%s[%d]: unimplemented software trap 0x%x\n",
p->p_comm, p->p_pid, type);
- trapsignal(p, SIGILL, type, (caddr_t)pc);
+ trapsignal(p, SIGILL, type, ILL_ILLOPC, (caddr_t)pc);
break;
#ifdef COMPAT_SVR4
@@ -357,11 +357,11 @@ badtrap:
break; /* the work is all in userret() */
case T_ILLINST:
- trapsignal(p, SIGILL, 0, (caddr_t)pc); /* XXX code?? */
+ trapsignal(p, SIGILL, 0, ILL_ILLOPC, (caddr_t)pc);
break;
case T_PRIVINST:
- trapsignal(p, SIGILL, 0, (caddr_t)pc); /* XXX code?? */
+ trapsignal(p, SIGILL, 0, ILL_PRVOPC, (caddr_t)pc);
break;
case T_FPDISABLED: {
@@ -380,7 +380,7 @@ badtrap:
fpu_emulate(p, tf, fs);
break;
#else
- trapsignal(p, SIGFPE, 0, (caddr_t)pc); /* XXX code?? */
+ trapsignal(p, SIGFPE, 0, FPE_FLTINV, (caddr_t)pc);
break;
#endif
}
@@ -465,7 +465,7 @@ badtrap:
break;
case T_ALIGN:
- trapsignal(p, SIGBUS, 0, (caddr_t)pc); /* XXX code?? */
+ trapsignal(p, SIGBUS, 0, BUS_ADRALN, (caddr_t)pc);
break;
case T_FPE:
@@ -490,21 +490,21 @@ badtrap:
break;
case T_TAGOF:
- trapsignal(p, SIGEMT, 0, (caddr_t)pc); /* XXX code?? */
+ trapsignal(p, SIGEMT, 0, EMT_TAGOVF, (caddr_t)pc);
break;
case T_CPDISABLED:
uprintf("coprocessor instruction\n"); /* XXX */
- trapsignal(p, SIGILL, 0, (caddr_t)pc); /* XXX code?? */
+ trapsignal(p, SIGILL, 0, FPE_FLTINV, (caddr_t)pc);
break;
case T_BREAKPOINT:
- trapsignal(p, SIGTRAP, 0, (caddr_t)pc);
+ trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, (caddr_t)pc);
break;
case T_DIV0:
ADVANCE;
- trapsignal(p, SIGFPE, FPE_INTDIV_TRAP, (caddr_t)pc);
+ trapsignal(p, SIGFPE, 0, FPE_INTDIV_TRAP, (caddr_t)pc);
break;
case T_FLUSHWIN:
@@ -524,7 +524,7 @@ badtrap:
case T_RANGECHECK:
uprintf("T_RANGECHECK\n"); /* XXX */
ADVANCE;
- trapsignal(p, SIGILL, 0, (caddr_t)pc); /* XXX code?? */
+ trapsignal(p, SIGILL, 0, ILL_ILLOPN, (caddr_t)pc);
break;
case T_FIXALIGN:
@@ -535,7 +535,7 @@ badtrap:
case T_INTOF:
uprintf("T_INTOF\n"); /* XXX */
ADVANCE;
- trapsignal(p, SIGFPE, FPE_INTOVF_TRAP, (caddr_t)pc);
+ trapsignal(p, SIGFPE, FPE_INTOVF_TRAP, FPE_INTOVF, (caddr_t)pc);
break;
}
userret(p, pc, sticks);
@@ -743,7 +743,7 @@ kfault:
tf->tf_npc = onfault + 4;
return;
}
- trapsignal(p, SIGSEGV, (u_int)v, (caddr_t)v);
+ trapsignal(p, SIGSEGV, (u_int)v, SEGV_MAPERR, (caddr_t)v);
}
out:
if ((psr & PSR_PS) == 0) {
@@ -1015,7 +1015,7 @@ kfault:
tf->tf_npc = onfault + 4;
return;
}
- trapsignal(p, SIGSEGV, (u_int)sfva, (caddr_t)sfva);
+ trapsignal(p, SIGSEGV, (u_int)sfva, SEGV_MAPERR, (caddr_t)sfva);
}
out:
if ((psr & PSR_PS) == 0) {