Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm Make compat_13_sys_sigreturn() work on arm26, a...



details:   https://anonhg.NetBSD.org/src/rev/533741a4d1d1
branches:  trunk
changeset: 504527:533741a4d1d1
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sun Mar 04 15:27:03 2001 +0000

description:
Make compat_13_sys_sigreturn() work on arm26, and move it from
arch/arm/arm32/compat_13_machdep.c to arch/arm/arm/compat_13_machdep.c.

diffstat:

 sys/arch/arm/arm/compat_13_machdep.c   |  118 +++++++++++++++++++++++++++++++++
 sys/arch/arm/arm32/compat_13_machdep.c |  107 -----------------------------
 sys/arch/arm/conf/files.arm            |    4 +-
 3 files changed, 120 insertions(+), 109 deletions(-)

diffs (258 lines):

diff -r 62f6d73eb782 -r 533741a4d1d1 sys/arch/arm/arm/compat_13_machdep.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/arm/compat_13_machdep.c      Sun Mar 04 15:27:03 2001 +0000
@@ -0,0 +1,118 @@
+/*     $NetBSD: compat_13_machdep.c,v 1.1 2001/03/04 15:27:03 bjh21 Exp $      */
+
+/*
+ * Copyright (c) 1994-1998 Mark Brinicombe.
+ * Copyright (c) 1994 Brini.
+ * All rights reserved.
+ *
+ * This code is derived from software written for Brini by Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by Mark Brinicombe
+ *     for the NetBSD Project.
+ * 4. The name of the company nor the name of the author may be used to
+ *    endorse or promote products derived from this software without specific
+ *    prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "opt_progmode.h"
+
+#include <sys/param.h>
+
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.1 2001/03/04 15:27:03 bjh21 Exp $");
+
+#include <sys/systm.h>
+#include <sys/signalvar.h>
+#include <sys/kernel.h>
+#include <sys/map.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/mount.h>  
+#include <sys/syscallargs.h>
+
+int
+compat_13_sys_sigreturn(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct compat_13_sys_sigreturn_args /* {
+               syscallarg(struct sigcontext13 *) sigcntxp;
+       } */ *uap = v;
+       struct sigcontext13 *scp, context;
+       struct trapframe *tf;
+       sigset_t mask;
+
+       /*
+        * The trampoline code hands us the context.
+        * It is unsafe to keep track of it ourselves, in the event that a
+        * program jumps out of a signal handler.
+        */
+       scp = SCARG(uap, sigcntxp);
+       if (copyin((caddr_t)scp, &context, sizeof(*scp)) != 0)
+               return (EFAULT);
+
+       /* Make sure the processor mode has not been tampered with. */
+#ifdef PROG32
+       if ((context.sc_spsr & PSR_MODE) != PSR_USR32_MODE)
+               return (EINVAL);
+#else /* PROG26 */
+       if ((context.sc_pc & R15_MODE) != R15_MODE_USR ||
+           (context.sc_pc & (R15_IRQ_DISABLE | R15_FIQ_DISABLE)) != 0)
+               return EINVAL;
+#endif
+
+       /* Restore register context. */
+       tf = p->p_addr->u_pcb.pcb_tf;
+       tf->tf_r0    = context.sc_r0;
+       tf->tf_r1    = context.sc_r1;
+       tf->tf_r2    = context.sc_r2;
+       tf->tf_r3    = context.sc_r3;
+       tf->tf_r4    = context.sc_r4;
+       tf->tf_r5    = context.sc_r5;
+       tf->tf_r6    = context.sc_r6;
+       tf->tf_r7    = context.sc_r7;
+       tf->tf_r8    = context.sc_r8;
+       tf->tf_r9    = context.sc_r9;
+       tf->tf_r10   = context.sc_r10;
+       tf->tf_r11   = context.sc_r11;
+       tf->tf_r12   = context.sc_r12;
+       tf->tf_usr_sp = context.sc_usr_sp;
+       tf->tf_usr_lr = context.sc_usr_lr;
+       tf->tf_svc_lr = context.sc_svc_lr;
+       tf->tf_pc    = context.sc_pc;
+       tf->tf_spsr  = context.sc_spsr;
+
+       /* Restore signal stack. */
+       if (context.sc_onstack & SS_ONSTACK)
+               p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK;
+       else
+               p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK;
+
+       /* Restore signal mask. */
+       native_sigset13_to_sigset(&context.sc_mask, &mask);
+       (void) sigprocmask1(p, SIG_SETMASK, &mask, 0);
+
+       return (EJUSTRETURN);
+}
diff -r 62f6d73eb782 -r 533741a4d1d1 sys/arch/arm/arm32/compat_13_machdep.c
--- a/sys/arch/arm/arm32/compat_13_machdep.c    Sun Mar 04 14:50:05 2001 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*     $NetBSD: compat_13_machdep.c,v 1.1 2001/03/04 08:25:39 matt Exp $       */
-
-/*
- * Copyright (c) 1994-1998 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by Mark Brinicombe
- *     for the NetBSD Project.
- * 4. The name of the company nor the name of the author may be used to
- *    endorse or promote products derived from this software without specific
- *    prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/mount.h>  
-#include <sys/syscallargs.h>
-
-int
-compat_13_sys_sigreturn(p, v, retval)
-       struct proc *p;
-       void *v;
-       register_t *retval;
-{
-       struct compat_13_sys_sigreturn_args /* {
-               syscallarg(struct sigcontext13 *) sigcntxp;
-       } */ *uap = v;
-       struct sigcontext13 *scp, context;
-       struct trapframe *tf;
-       sigset_t mask;
-
-       /*
-        * The trampoline code hands us the context.
-        * It is unsafe to keep track of it ourselves, in the event that a
-        * program jumps out of a signal handler.
-        */
-       scp = SCARG(uap, sigcntxp);
-       if (copyin((caddr_t)scp, &context, sizeof(*scp)) != 0)
-               return (EFAULT);
-
-       /* Make sure the processor mode has not been tampered with. */
-       if ((context.sc_spsr & PSR_MODE) != PSR_USR32_MODE)
-               return (EINVAL);
-
-       /* Restore register context. */
-       tf = p->p_addr->u_pcb.pcb_tf;
-       tf->tf_r0    = context.sc_r0;
-       tf->tf_r1    = context.sc_r1;
-       tf->tf_r2    = context.sc_r2;
-       tf->tf_r3    = context.sc_r3;
-       tf->tf_r4    = context.sc_r4;
-       tf->tf_r5    = context.sc_r5;
-       tf->tf_r6    = context.sc_r6;
-       tf->tf_r7    = context.sc_r7;
-       tf->tf_r8    = context.sc_r8;
-       tf->tf_r9    = context.sc_r9;
-       tf->tf_r10   = context.sc_r10;
-       tf->tf_r11   = context.sc_r11;
-       tf->tf_r12   = context.sc_r12;
-       tf->tf_usr_sp = context.sc_usr_sp;
-       tf->tf_usr_lr = context.sc_usr_lr;
-       tf->tf_svc_lr = context.sc_svc_lr;
-       tf->tf_pc    = context.sc_pc;
-       tf->tf_spsr  = context.sc_spsr;
-
-       /* Restore signal stack. */
-       if (context.sc_onstack & SS_ONSTACK)
-               p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK;
-       else
-               p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK;
-
-       /* Restore signal mask. */
-       native_sigset13_to_sigset(&context.sc_mask, &mask);
-       (void) sigprocmask1(p, SIG_SETMASK, &mask, 0);
-
-       return (EJUSTRETURN);
-}
diff -r 62f6d73eb782 -r 533741a4d1d1 sys/arch/arm/conf/files.arm
--- a/sys/arch/arm/conf/files.arm       Sun Mar 04 14:50:05 2001 +0000
+++ b/sys/arch/arm/conf/files.arm       Sun Mar 04 15:27:03 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.arm,v 1.15 2001/03/04 08:25:38 matt Exp $
+#      $NetBSD: files.arm,v 1.16 2001/03/04 15:27:03 bjh21 Exp $
 
 # temporary define to allow easy moving to ../arch/arm/arm32
 defopt ARM32
@@ -42,6 +42,7 @@
 # files related to debugging
 file   arch/arm/arm/disassem.c
 
+file   arch/arm/arm/compat_13_machdep.c        compat_13
 file   arch/arm/arm/process_machdep.c
 file   arch/arm/arm/sig_machdep.c
 file   arch/arm/arm/sigcode.S
@@ -52,7 +53,6 @@
 file   arch/arm/arm/disksubr_mbr.c             disk
 
 # files common to arm32 implementations
-file   arch/arm/arm32/compat_13_machdep.c      arm32 & compat_13
 file   arch/arm/arm32/pmap.c                   arm32
 file   arch/arm/arm32/syscall.c                arm32
 file   arch/arm/arm32/sys_machdep.c            arm32



Home | Main Index | Thread Index | Old Index