summaryrefslogtreecommitdiff
path: root/sys/arch/sh
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2012-04-13 18:09:02 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2012-04-13 18:09:02 +0000
commitff3ab5c88cd7f299cb140589bedf377f55066f94 (patch)
tree9f47e3224c515492fd67d0cc8da2d873f82d418e /sys/arch/sh
parent8824b33cb80578e84a380fdd89d5045356aecdf7 (diff)
Avoid horrible namespace pollution of <machine/signal.h> pulling in
<machine/reg.h> for the needs of struct sigcontext; said struct ought to only use simple integer types. Fixes build of groff on landisk. ok pirofti@ (who had a similar diff)
Diffstat (limited to 'sys/arch/sh')
-rw-r--r--sys/arch/sh/include/signal.h6
-rw-r--r--sys/arch/sh/sh/sh_machdep.c52
2 files changed, 9 insertions, 49 deletions
diff --git a/sys/arch/sh/include/signal.h b/sys/arch/sh/include/signal.h
index 69f218d1257..fad3755efc9 100644
--- a/sys/arch/sh/include/signal.h
+++ b/sys/arch/sh/include/signal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.h,v 1.3 2011/11/21 18:17:28 deraadt Exp $ */
+/* $OpenBSD: signal.h,v 1.4 2012/04/13 18:09:01 miod Exp $ */
/* $NetBSD: signal.h,v 1.12 2005/12/11 12:18:58 christos Exp $ */
/*
@@ -50,8 +50,8 @@ typedef int sig_atomic_t;
* a non-standard exit is performed.
*/
struct sigcontext {
- struct reg sc_reg;
- struct fpreg sc_fpreg;
+ int sc_reg[21];
+ int sc_fpreg[34];
int sc_onstack; /* sigstack state to restore */
diff --git a/sys/arch/sh/sh/sh_machdep.c b/sys/arch/sh/sh/sh_machdep.c
index 7d89f618c31..28d96a9a250 100644
--- a/sys/arch/sh/sh/sh_machdep.c
+++ b/sys/arch/sh/sh/sh_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sh_machdep.c,v 1.31 2011/07/05 04:48:01 guenther Exp $ */
+/* $OpenBSD: sh_machdep.c,v 1.32 2012/04/13 18:09:01 miod Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */
/*
@@ -484,30 +484,10 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
sip = NULL;
/* Save register context. */
- frame.sf_uc.sc_reg.r_spc = tf->tf_spc;
- frame.sf_uc.sc_reg.r_ssr = tf->tf_ssr;
- frame.sf_uc.sc_reg.r_pr = tf->tf_pr;
- frame.sf_uc.sc_reg.r_mach = tf->tf_mach;
- frame.sf_uc.sc_reg.r_macl = tf->tf_macl;
- frame.sf_uc.sc_reg.r_r15 = tf->tf_r15;
- frame.sf_uc.sc_reg.r_r14 = tf->tf_r14;
- frame.sf_uc.sc_reg.r_r13 = tf->tf_r13;
- frame.sf_uc.sc_reg.r_r12 = tf->tf_r12;
- frame.sf_uc.sc_reg.r_r11 = tf->tf_r11;
- frame.sf_uc.sc_reg.r_r10 = tf->tf_r10;
- frame.sf_uc.sc_reg.r_r9 = tf->tf_r9;
- frame.sf_uc.sc_reg.r_r8 = tf->tf_r8;
- frame.sf_uc.sc_reg.r_r7 = tf->tf_r7;
- frame.sf_uc.sc_reg.r_r6 = tf->tf_r6;
- frame.sf_uc.sc_reg.r_r5 = tf->tf_r5;
- frame.sf_uc.sc_reg.r_r4 = tf->tf_r4;
- frame.sf_uc.sc_reg.r_r3 = tf->tf_r3;
- frame.sf_uc.sc_reg.r_r2 = tf->tf_r2;
- frame.sf_uc.sc_reg.r_r1 = tf->tf_r1;
- frame.sf_uc.sc_reg.r_r0 = tf->tf_r0;
+ memcpy(frame.sf_uc.sc_reg, &tf->tf_spc, sizeof(frame.sf_uc.sc_reg));
#ifdef SH4
if (CPU_IS_SH4)
- fpu_save(&frame.sf_uc.sc_fpreg);
+ fpu_save((struct fpreg *)&frame.sf_uc.sc_fpreg);
#endif
frame.sf_uc.sc_onstack = onstack;
@@ -565,34 +545,14 @@ sys_sigreturn(struct proc *p, void *v, register_t *retval)
tf = p->p_md.md_regs;
/* Check for security violations. */
- if (((context.sc_reg.r_ssr ^ tf->tf_ssr) & PSL_USERSTATIC) != 0)
+ if (((context.sc_reg[1] /* ssr */ ^ tf->tf_ssr) & PSL_USERSTATIC) != 0)
return (EINVAL);
- tf->tf_spc = context.sc_reg.r_spc;
- tf->tf_ssr = context.sc_reg.r_ssr;
- tf->tf_macl = context.sc_reg.r_macl;
- tf->tf_mach = context.sc_reg.r_mach;
- tf->tf_pr = context.sc_reg.r_pr;
- tf->tf_r13 = context.sc_reg.r_r13;
- tf->tf_r12 = context.sc_reg.r_r12;
- tf->tf_r11 = context.sc_reg.r_r11;
- tf->tf_r10 = context.sc_reg.r_r10;
- tf->tf_r9 = context.sc_reg.r_r9;
- tf->tf_r8 = context.sc_reg.r_r8;
- tf->tf_r7 = context.sc_reg.r_r7;
- tf->tf_r6 = context.sc_reg.r_r6;
- tf->tf_r5 = context.sc_reg.r_r5;
- tf->tf_r4 = context.sc_reg.r_r4;
- tf->tf_r3 = context.sc_reg.r_r3;
- tf->tf_r2 = context.sc_reg.r_r2;
- tf->tf_r1 = context.sc_reg.r_r1;
- tf->tf_r0 = context.sc_reg.r_r0;
- tf->tf_r15 = context.sc_reg.r_r15;
- tf->tf_r14 = context.sc_reg.r_r14;
+ memcpy(&tf->tf_spc, context.sc_reg, sizeof(context.sc_reg));
#ifdef SH4
if (CPU_IS_SH4)
- fpu_restore(&context.sc_fpreg);
+ fpu_restore((struct fpreg *)&context.sc_fpreg);
#endif
/* Restore signal stack. */