-/* $OpenBSD: locore.s,v 1.13 1997/01/16 09:23:22 niklas Exp $ */
+/* $OpenBSD: locore.s,v 1.14 1997/02/03 11:38:05 deraadt Exp $ */
/* $NetBSD: locore.s,v 1.72 1996/12/17 11:09:10 is Exp $ */
/*
* sp+0 -> signal number
* sp+4 signal specific code
* sp+8 pointer to signal context frame (scp)
- * sp+12 address of handler
- * sp+16 saved hardware state
+ * sp+12 pointer to siginfo (sip)
+ * sp+16 address of handler
+ * sp+30 saved hardware state
* .
* .
* scp+0-> beginning of signal context frame
.globl _sigcode, _esigcode
.data
_sigcode:
- movl sp@(12),a0 | signal handler addr (4 bytes)
+ movl sp@(16),a0 | signal handler addr (4 bytes)
jsr a0@ | call signal handler (2 bytes)
addql #4,sp | pop signo (2 bytes)
trap #1 | special syscall entry (2 bytes)
-/* $OpenBSD: machdep.c,v 1.18 1997/01/18 12:48:01 niklas Exp $ */
+/* $OpenBSD: machdep.c,v 1.19 1997/02/03 11:38:08 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.82 1996/12/17 07:32:54 is Exp $ */
/*
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 DEBUG
* Send an interrupt to process.
*/
void
-sendsig(catcher, sig, mask, code)
+sendsig(catcher, sig, mask, code, type, val)
sig_t catcher;
int sig, mask;
u_long code;
+ int type;
+ union sigval val;
{
register struct proc *p = curproc;
register struct sigframe *fp, *kfp;
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, code, type, val);
+ }
+
(void) copyout((caddr_t)kfp, (caddr_t)fp, sizeof(struct sigframe));
frame->f_regs[SP] = (int)fp;
#ifdef DEBUG
-/* $OpenBSD: trap.c,v 1.10 1997/01/19 13:53:12 niklas Exp $ */
+/* $OpenBSD: trap.c,v 1.11 1997/02/03 11:38:10 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.53 1997/01/16 15:30:57 gwr Exp $ */
/*
type, code);
panictrap(type, code, v, fp);
}
- trapsignal(p, SIGSEGV, v);
+ trapsignal(p, SIGSEGV, v, T_MMUFLT, (caddr_t)v);
if ((type & T_USER) == 0)
return;
userret(p, fp->f_pc, sticks);
struct proc *p;
u_int ucode;
u_quad_t sticks = 0;
- int i;
+ int typ, i;
#ifdef COMPAT_SUNOS
extern struct emul emul_sunos;
#endif
p = curproc;
- ucode = 0;
+ typ = ucode = 0;
cnt.v_trap++;
if (USERMODE(frame.f_sr)) {
* User Bus/Addr error.
*/
case T_BUSERR|T_USER:
+ ucode = code & ~T_USER;
+ typ = BUS_OBJERR;
+ i = SIGBUS;
+ break;
case T_ADDRERR|T_USER:
+ ucode = code & ~T_USER;
+ typ = BUS_ADRALN;
i = SIGBUS;
break;
/*
* User illegal/privleged inst fault
*/
case T_ILLINST|T_USER:
+ ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
+ typ = ILL_ILLOPC;
+ i = SIGILL;
+ break;
case T_PRIVINST|T_USER:
ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
+ typ = ILL_PRVOPC;
i = SIGILL;
break;
/*
* divde by zero, CHK/TRAPV inst
*/
case T_ZERODIV|T_USER:
+ ucode = frame.f_format;
+ typ = FPE_INTDIV;
+ i = SIGFPE;
+ break;
case T_CHKINST|T_USER:
+ ucode = frame.f_format;
+ typ = FPE_FLTSUB;
+ i = SIGFPE;
+ break;
case T_TRAPVINST|T_USER:
ucode = frame.f_format;
+ typ = FPE_FLTOVF;
i = SIGFPE;
break;
#ifdef FPCOPROC
*/
case T_COPERR|T_USER:
ucode = 0;
+ typ = FPE_FLTINV;
i = SIGFPE; /* XXX What is a proper response here? */
break;
/*
* there is no clash.
*/
ucode = code;
+ typ = FPE_FLTRES;
i = SIGFPE;
break;
/*
p->p_sigignore &= ~i;
p->p_sigcatch &= ~i;
p->p_sigmask &= ~i;
+ typ = ILL_COPROC;
i = SIGILL;
ucode = frame.f_format; /* XXX was ILL_RESAD_FAULT */
break;
case T_TRACE:
case T_TRAP15:
frame.f_sr &= ~PSL_T;
+ typ = TRAP_TRACE;
i = SIGTRAP;
break;
case T_TRACE|T_USER:
}
#endif
frame.f_sr &= ~PSL_T;
+ typ = TRAP_TRACE;
i = SIGTRAP;
break;
/*
printf("trapsignal(%d, %d, %d, %x, %x)\n", p->p_pid, i,
ucode, v, frame.f_pc);
#endif
- trapsignal(p, i, ucode);
+ trapsignal(p, i, ucode, typ, (caddr_t)ucode);
if ((type & T_USER) == 0)
return;
userret(p, frame.f_pc, sticks);