diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-01-12 23:55:13 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-01-12 23:55:13 +0000 |
commit | e54f346d60f10acd6702270cef7b811739b83f1f (patch) | |
tree | 9d8112bc0ba1fc4894e86269e8f6bf31470c96da | |
parent | f49a410f277b1db9f52b54c748037f8609817b07 (diff) |
Use a struct reg in struct sigcontext, rather than an unsorted pot-pourri
of registers. This also makes signal and sigreturn much simpler.
-rw-r--r-- | sys/arch/mvme88k/include/signal.h | 42 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 116 |
2 files changed, 11 insertions, 147 deletions
diff --git a/sys/arch/mvme88k/include/signal.h b/sys/arch/mvme88k/include/signal.h index d001e0fb29b..791679b0b03 100644 --- a/sys/arch/mvme88k/include/signal.h +++ b/sys/arch/mvme88k/include/signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.h,v 1.10 2004/01/12 21:33:15 miod Exp $ */ +/* $OpenBSD: signal.h,v 1.11 2004/01/12 23:55:10 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -33,6 +33,8 @@ #ifndef __MACHINE_SIGNAL_H__ #define __MACHINE_SIGNAL_H__ +#include <machine/reg.h> + typedef int sig_atomic_t; /* @@ -48,43 +50,7 @@ struct sigcontext { int sc_onstack; /* sigstack state to restore */ int sc_mask; /* signal mask to restore */ /* begin machine dependent portion */ - int sc_regs[32]; -#define sc_sp sc_regs[31] - int sc_ps; - int sc_fpsr; - int sc_fpcr; - int sc_xip; - int sc_nip; - int sc_fip; - int sc_ssbr; -#define sc_duap sc_ssbr /* mc88110 */ - int sc_dmt0; -#define sc_dsr sc_dmt0 /* mc88110 */ - int sc_dmd0; -#define sc_dlar sc_dmd0 /* mc88110 */ - int sc_dma0; -#define sc_dpar sc_dma0 /* mc88110 */ - int sc_dmt1; -#define sc_isr sc_dmt1 /* mc88110 */ - int sc_dmd1; -#define sc_ilar sc_dmd1 /* mc88110 */ - int sc_dma1; -#define sc_ipar sc_dma1 /* mc88110 */ - int sc_dmt2; -#define sc_isap sc_dmt2 /* mc88110 */ - int sc_dmd2; -#define sc_dsap sc_dmd2 /* mc88110 */ - int sc_dma2; -#define sc_iuap sc_dma2 /* mc88110 */ - int sc_fpecr; - int sc_fphs1; - int sc_fpls1; - int sc_fphs2; - int sc_fpls2; - int sc_fppt; - int sc_fprh; - int sc_fprl; - int sc_fpit; + struct reg sc_regs; /* XXX this structure needs to be a multiple of 8 bytes for now */ int sc_pad; diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index c0d95244f75..0aef70d3a93 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.129 2004/01/12 17:30:26 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.130 2004/01/12 23:55:12 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -907,63 +907,8 @@ sendsig(catcher, sig, mask, code, type, val) * Copy the whole user context into signal context that we * are building. */ - bcopy((caddr_t)tf->tf_r, (caddr_t)sf.sf_sc.sc_regs, - sizeof(sf.sf_sc.sc_regs)); - - /* - * Be sure to keep the xip values intact, especially on 88100: should - * we return back to the process, it must be in the same instruction - * fetching state, or bad things will happen... - */ - if (cputyp != CPU_88110) { - /* mc88100 */ - sf.sf_sc.sc_xip = tf->tf_sxip; - sf.sf_sc.sc_nip = tf->tf_snip; - sf.sf_sc.sc_fip = tf->tf_sfip; - } else { - /* mc88110 */ - sf.sf_sc.sc_xip = tf->tf_exip; - sf.sf_sc.sc_nip = tf->tf_enip; - sf.sf_sc.sc_fip = 0; - } - sf.sf_sc.sc_ps = tf->tf_epsr; - sf.sf_sc.sc_sp = tf->tf_r[31]; - sf.sf_sc.sc_fpsr = tf->tf_fpsr; - sf.sf_sc.sc_fpcr = tf->tf_fpcr; - if (cputyp != CPU_88110) { - /* mc88100 */ - sf.sf_sc.sc_ssbr = tf->tf_ssbr; - sf.sf_sc.sc_dmt0 = tf->tf_dmt0; - sf.sf_sc.sc_dmd0 = tf->tf_dmd0; - sf.sf_sc.sc_dma0 = tf->tf_dma0; - sf.sf_sc.sc_dmt1 = tf->tf_dmt1; - sf.sf_sc.sc_dmd1 = tf->tf_dmd1; - sf.sf_sc.sc_dma1 = tf->tf_dma1; - sf.sf_sc.sc_dmt2 = tf->tf_dmt2; - sf.sf_sc.sc_dmd2 = tf->tf_dmd2; - sf.sf_sc.sc_dma2 = tf->tf_dma2; - } else { - /* mc88110 */ - sf.sf_sc.sc_dsr = tf->tf_dsr; - sf.sf_sc.sc_dlar = tf->tf_dlar; - sf.sf_sc.sc_dpar = tf->tf_dpar; - sf.sf_sc.sc_isr = tf->tf_isr; - sf.sf_sc.sc_ilar = tf->tf_ilar; - sf.sf_sc.sc_ipar = tf->tf_ipar; - sf.sf_sc.sc_isap = tf->tf_isap; - sf.sf_sc.sc_dsap = tf->tf_dsap; - sf.sf_sc.sc_iuap = tf->tf_iuap; - sf.sf_sc.sc_duap = tf->tf_duap; - } - sf.sf_sc.sc_fpecr = tf->tf_fpecr; - sf.sf_sc.sc_fphs1 = tf->tf_fphs1; - sf.sf_sc.sc_fpls1 = tf->tf_fpls1; - sf.sf_sc.sc_fphs2 = tf->tf_fphs2; - sf.sf_sc.sc_fpls2 = tf->tf_fpls2; - sf.sf_sc.sc_fppt = tf->tf_fppt; - sf.sf_sc.sc_fprh = tf->tf_fprh; - sf.sf_sc.sc_fprl = tf->tf_fprl; - sf.sf_sc.sc_fpit = tf->tf_fpit; + bcopy((const void *)&tf->tf_regs, (void *)&sf.sf_sc.sc_regs, + sizeof(sf.sf_sc.sc_regs)); if (copyout((caddr_t)&sf, (caddr_t)fp, sizeof sf)) { /* @@ -1030,7 +975,7 @@ sys_sigreturn(p, v, retval) if (sigdebug & SDB_FOLLOW) printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp); #endif - if ((int)scp & 3 || + if (((vaddr_t)scp & 3) != 0 || copyin((caddr_t)scp, (caddr_t)&ksc, sizeof(struct sigcontext))) return (EINVAL); @@ -1042,56 +987,8 @@ sys_sigreturn(p, v, retval) * bcopy(sc_reg to tf, sizeof sigcontext - 2 words) * XXX nivas */ - bcopy((caddr_t)scp->sc_regs, (caddr_t)tf->tf_r, sizeof(scp->sc_regs)); - if (cputyp != CPU_88110) { - /* mc88100 */ - tf->tf_sxip = scp->sc_xip; - tf->tf_snip = scp->sc_nip; - tf->tf_sfip = scp->sc_fip; - } else { - /* mc88110 */ - tf->tf_exip = scp->sc_xip; - tf->tf_enip = scp->sc_nip; - tf->tf_sfip = 0; - } - tf->tf_epsr = scp->sc_ps; - tf->tf_r[31] = scp->sc_sp; - tf->tf_fpsr = scp->sc_fpsr; - tf->tf_fpcr = scp->sc_fpcr; - if (cputyp != CPU_88110) { - /* mc88100 */ - tf->tf_ssbr = scp->sc_ssbr; - tf->tf_dmt0 = scp->sc_dmt0; - tf->tf_dmd0 = scp->sc_dmd0; - tf->tf_dma0 = scp->sc_dma0; - tf->tf_dmt1 = scp->sc_dmt1; - tf->tf_dmd1 = scp->sc_dmd1; - tf->tf_dma1 = scp->sc_dma1; - tf->tf_dmt2 = scp->sc_dmt2; - tf->tf_dmd2 = scp->sc_dmd2; - tf->tf_dma2 = scp->sc_dma2; - } else { - /* mc88110 */ - tf->tf_dsr = scp->sc_dsr; - tf->tf_dlar = scp->sc_dlar; - tf->tf_dpar = scp->sc_dpar; - tf->tf_isr = scp->sc_isr; - tf->tf_ilar = scp->sc_ilar; - tf->tf_ipar = scp->sc_ipar; - tf->tf_isap = scp->sc_isap; - tf->tf_dsap = scp->sc_dsap; - tf->tf_iuap = scp->sc_iuap; - tf->tf_duap = scp->sc_duap; - } - tf->tf_fpecr = scp->sc_fpecr; - tf->tf_fphs1 = scp->sc_fphs1; - tf->tf_fpls1 = scp->sc_fpls1; - tf->tf_fphs2 = scp->sc_fphs2; - tf->tf_fpls2 = scp->sc_fpls2; - tf->tf_fppt = scp->sc_fppt; - tf->tf_fprh = scp->sc_fprh; - tf->tf_fprl = scp->sc_fprl; - tf->tf_fpit = scp->sc_fpit; + bcopy((const void *)&scp->sc_regs, (caddr_t)&tf->tf_regs, + sizeof(scp->sc_regs)); /* * Restore the user supplied information @@ -1101,6 +998,7 @@ sys_sigreturn(p, v, retval) else p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK; p->p_sigmask = scp->sc_mask & ~sigcantmask; + return (EJUSTRETURN); } |