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
/* 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:
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:
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:
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_ */
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 */
* 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;
#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
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);
}
/*
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
* 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;
/*
* 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;
/* ... 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
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: {
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
}
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:
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:
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:
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);
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) {
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) {