From: deraadt Date: Mon, 3 Feb 1997 11:38:05 +0000 (+0000) Subject: SA_SIGINFO implementation X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a770a760e508040c63db89bae0a5afcc9ae0d016;p=openbsd SA_SIGINFO implementation --- diff --git a/sys/arch/amiga/amiga/locore.s b/sys/arch/amiga/amiga/locore.s index a10545bb671..ec274be347c 100644 --- a/sys/arch/amiga/amiga/locore.s +++ b/sys/arch/amiga/amiga/locore.s @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -1149,8 +1149,9 @@ _proc_trampoline: * 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 @@ -1158,7 +1159,7 @@ _proc_trampoline: .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) diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index 5796b561a68..0b51f1b67c1 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -727,9 +727,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 DEBUG @@ -744,10 +746,12 @@ int sigpid = 0; * 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; @@ -871,6 +875,12 @@ printf("sendsig %d %d %x %x %x\n", p->p_pid, sig, mask, code, catcher); 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 diff --git a/sys/arch/amiga/amiga/trap.c b/sys/arch/amiga/amiga/trap.c index 8e22cb712e3..bd0023b2999 100644 --- a/sys/arch/amiga/amiga/trap.c +++ b/sys/arch/amiga/amiga/trap.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -508,7 +508,7 @@ nogo: 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); @@ -528,13 +528,13 @@ trap(type, code, v, frame) 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)) { @@ -570,24 +570,44 @@ trap(type, code, v, frame) * 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 @@ -596,6 +616,7 @@ trap(type, code, v, frame) */ case T_COPERR|T_USER: ucode = 0; + typ = FPE_FLTINV; i = SIGFPE; /* XXX What is a proper response here? */ break; /* @@ -613,6 +634,7 @@ trap(type, code, v, frame) * there is no clash. */ ucode = code; + typ = FPE_FLTRES; i = SIGFPE; break; /* @@ -639,6 +661,7 @@ trap(type, code, v, frame) 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; @@ -656,6 +679,7 @@ trap(type, code, v, frame) case T_TRACE: case T_TRAP15: frame.f_sr &= ~PSL_T; + typ = TRAP_TRACE; i = SIGTRAP; break; case T_TRACE|T_USER: @@ -673,6 +697,7 @@ trap(type, code, v, frame) } #endif frame.f_sr &= ~PSL_T; + typ = TRAP_TRACE; i = SIGTRAP; break; /* @@ -713,7 +738,7 @@ trap(type, code, v, frame) 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);