diff options
author | Dale S. Rahn <rahnds@cvs.openbsd.org> | 1997-02-05 01:33:56 +0000 |
---|---|---|
committer | Dale S. Rahn <rahnds@cvs.openbsd.org> | 1997-02-05 01:33:56 +0000 |
commit | b4e0a7c0dc980746d2892b0b61e23f4d486c70c2 (patch) | |
tree | b9d5fcccc10b71891c325c4e67c30bbaac605b4e /sys/arch/powerpc | |
parent | 5c6f154c6db22f2fafc5d4afc4437ca2757cbf78 (diff) |
Siginfo changes.
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r-- | sys/arch/powerpc/include/frame.h | 30 | ||||
-rw-r--r-- | sys/arch/powerpc/include/signal.h | 32 | ||||
-rw-r--r-- | sys/arch/powerpc/powerpc/machdep.c | 16 | ||||
-rw-r--r-- | sys/arch/powerpc/powerpc/trap.c | 8 |
4 files changed, 46 insertions, 40 deletions
diff --git a/sys/arch/powerpc/include/frame.h b/sys/arch/powerpc/include/frame.h index 7e9562ed3eb..3c184262d0f 100644 --- a/sys/arch/powerpc/include/frame.h +++ b/sys/arch/powerpc/include/frame.h @@ -1,4 +1,4 @@ -/* $OpenBSD: frame.h,v 1.2 1996/12/28 06:25:09 rahnds Exp $ */ +/* $OpenBSD: frame.h,v 1.3 1997/02/05 01:33:51 rahnds Exp $ */ /* $NetBSD: frame.h,v 1.1 1996/09/30 16:34:25 ws Exp $ */ /* @@ -37,28 +37,6 @@ #include <machine/types.h> /* - * We have to save all registers on every trap, because - * 1. user could attach this process every time - * 2. we must be able to restore all user registers in case of fork - * Actually, we do not save the fp registers on trap, since - * these are not used by the kernel. They are saved only when switching - * between processes using the FPU. - * - * Change ordering to cluster together these register_t's. XXX - */ -struct trapframe { - register_t fixreg[32]; - register_t lr; - int cr; - int xer; - register_t ctr; - register_t srr0; - register_t srr1; - register_t dar; /* dar & dsisr are only filled on a DSI trap */ - int dsisr; - int exc; -}; -/* * This is to ensure alignment of the stackpointer */ #define FRAMELEN roundup(sizeof(struct trapframe) + 8, 16) @@ -90,4 +68,10 @@ struct callframe { register_t r31; }; +struct sigframe { + int sf_signum; + siginfo_t *sf_sip; + struct sigcontext sf_sc; + siginfo_t sf_si; +}; #endif /* _MACHINE_FRAME_H_ */ diff --git a/sys/arch/powerpc/include/signal.h b/sys/arch/powerpc/include/signal.h index 7f573209ac3..3c629efde6c 100644 --- a/sys/arch/powerpc/include/signal.h +++ b/sys/arch/powerpc/include/signal.h @@ -1,3 +1,4 @@ +/* $OpenBSD: signal.h,v 1.2 1997/02/05 01:33:53 rahnds Exp $ */ /* $NetBSD: signal.h,v 1.1 1996/09/30 16:34:34 ws Exp $ */ /* @@ -33,19 +34,34 @@ #ifndef _MACHINE_SIGNAL_H_ #define _MACHINE_SIGNAL_H_ -#include <machine/frame.h> - typedef int sig_atomic_t; +/* + * We have to save all registers on every trap, because + * 1. user could attach this process every time + * 2. we must be able to restore all user registers in case of fork + * Actually, we do not save the fp registers on trap, since + * these are not used by the kernel. They are saved only when switching + * between processes using the FPU. + * + * Change ordering to cluster together these register_t's. XXX + */ +struct trapframe { + register_t fixreg[32]; + register_t lr; + int cr; + int xer; + register_t ctr; + register_t srr0; + register_t srr1; + register_t dar; /* dar & dsisr are only filled on a DSI trap */ + int dsisr; + int exc; +}; + struct sigcontext { int sc_onstack; /* saved onstack flag */ int sc_mask; /* saved signal mask */ struct trapframe sc_frame; /* saved registers */ }; - -struct sigframe { - int sf_signum; - int sf_code; - struct sigcontext sf_sc; -}; #endif /* _MACHINE_SIGNAL_H_ */ diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c index 55d9d9f9306..fce1130babf 100644 --- a/sys/arch/powerpc/powerpc/machdep.c +++ b/sys/arch/powerpc/powerpc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.4 1997/01/20 20:43:48 rahnds Exp $ */ +/* $OpenBSD: machdep.c,v 1.5 1997/02/05 01:33:54 rahnds Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -536,10 +536,12 @@ setregs(p, pack, stack, retval) * Send a signal 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; { struct proc *p = curproc; struct trapframe *tf; @@ -565,21 +567,25 @@ sendsig(catcher, sig, mask, code) fp = (struct sigframe *)tf->fixreg[1]; fp = (struct sigframe *)((int)(fp - 1) & ~0xf); - frame.sf_code = code; - /* * Generate signal context for SYS_sigreturn. */ frame.sf_sc.sc_onstack = oldonstack; frame.sf_sc.sc_mask = mask; + frame.sf_sip = NULL; bcopy(tf, &frame.sf_sc.sc_frame, sizeof *tf); + if (psp->ps_siginfo & sigmask(sig)) { + frame.sf_sip = &fp->sf_si; + initsiginfo(&frame.sf_si, sig, code, type, val); + } if (copyout(&frame, fp, sizeof frame) != 0) sigexit(p, SIGILL); + tf->fixreg[1] = (int)fp; tf->lr = (int)catcher; tf->fixreg[3] = (int)sig; - tf->fixreg[4] = (int)code; + tf->fixreg[4] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : NULL; tf->fixreg[5] = (int)&frame.sf_sc; tf->srr0 = (int)(((char *)PS_STRINGS) - (p->p_emul->e_esigcode - p->p_emul->e_sigcode)); diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index eef22d8fdf3..3cbf4252a88 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.3 1996/12/28 06:22:27 rahnds Exp $ */ +/* $OpenBSD: trap.c,v 1.4 1997/02/05 01:33:55 rahnds Exp $ */ /* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */ /* @@ -124,7 +124,7 @@ printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0); break; } printf("dsi on addr %x iar %x\n", frame->dar, frame->srr0); - trapsignal(p, SIGSEGV, EXC_DSI); + trapsignal(p, SIGSEGV, EXC_DSI, SEGV_MAPERR, frame->dar); break; case EXC_ISI|EXC_USER: { @@ -137,7 +137,7 @@ printf("dsi on addr %x iar %x\n", frame->dar, frame->srr0); break; } printf("isi iar %x\n", frame->srr0); - trapsignal(p, SIGSEGV, EXC_ISI); + trapsignal(p, SIGSEGV, EXC_ISI, SEGV_MAPERR, frame->srr0); break; case EXC_SC|EXC_USER: { @@ -261,7 +261,7 @@ brain_damage: case EXC_PGM|EXC_USER: printf("pgm iar %x\n", frame->srr0); - trapsignal(p, SIGILL,EXC_PGM); + trapsignal(p, SIGILL, EXC_PGM, ILL_ILLOPC, frame->srr0); break; case EXC_AST|EXC_USER: /* This is just here that we trap */ |