Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys OMG it builds!



details:   https://anonhg.NetBSD.org/src/rev/09c9dd073e16
branches:  pgoyette-compat
changeset: 830703:09c9dd073e16
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Sep 14 08:38:37 2018 +0000

description:
OMG it builds!

Finish rearranging the amd64 MD compat_netbsd32 code.

XXX Other architectures will be dealt with later.

diffstat:

 sys/arch/amd64/amd64/netbsd32_machdep.c    |  75 ++---------------------------
 sys/arch/amd64/amd64/netbsd32_machdep_16.c |  17 ++----
 sys/arch/amd64/conf/files.amd64            |   4 +-
 sys/arch/xen/conf/files.xen                |   4 +-
 sys/compat/netbsd32/netbsd32.h             |  13 ++++-
 sys/compat/netbsd32/netbsd32_compat_16.c   |  23 ++------
 sys/compat/netbsd32/netbsd32_mod.c         |  38 ++++----------
 sys/modules/compat_netbsd32/Makefile       |  10 ++-
 sys/modules/compat_netbsd32_16/Makefile    |   8 ++-
 9 files changed, 59 insertions(+), 133 deletions(-)

diffs (truncated from 408 to 300 lines):

diff -r c82dec9cdc4d -r 09c9dd073e16 sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Fri Sep 14 06:21:17 2018 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Fri Sep 14 08:38:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.115.2.2 2018/09/14 05:37:08 pgoyette Exp $      */
+/*     $NetBSD: netbsd32_machdep.c,v 1.115.2.3 2018/09/14 08:38:37 pgoyette Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.115.2.2 2018/09/14 05:37:08 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.115.2.3 2018/09/14 08:38:37 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -279,66 +279,6 @@
        (*vec_netbsd32_sendsig)(ksi, mask);
 }
 
-int
-compat_16_netbsd32___sigreturn14(struct lwp *l, const struct compat_16_netbsd32___sigreturn14_args *uap, register_t *retval)
-{
-       /* {
-               syscallarg(netbsd32_sigcontextp_t) sigcntxp;
-       } */
-       struct netbsd32_sigcontext *scp, context;
-       struct proc *p = l->l_proc;
-       struct trapframe *tf;
-       int error;
-
-       /*
-        * 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 = NETBSD32PTR64(SCARG(uap, sigcntxp));
-       if (copyin(scp, &context, sizeof(*scp)) != 0)
-               return (EFAULT);
-
-       /*
-        * Check for security violations.
-        */
-       error = check_sigcontext32(l, &context);
-       if (error != 0)
-               return error;
-
-       /* Restore register context. */
-       tf = l->l_md.md_regs;
-       tf->tf_ds = context.sc_ds & 0xFFFF;
-       tf->tf_es = context.sc_es & 0xFFFF;
-       cpu_fsgs_reload(l, context.sc_fs, context.sc_gs);
-       tf->tf_rflags = context.sc_eflags;
-       tf->tf_rdi = context.sc_edi;
-       tf->tf_rsi = context.sc_esi;
-       tf->tf_rbp = context.sc_ebp;
-       tf->tf_rbx = context.sc_ebx;
-       tf->tf_rdx = context.sc_edx;
-       tf->tf_rcx = context.sc_ecx;
-       tf->tf_rax = context.sc_eax;
-
-       tf->tf_rip = context.sc_eip;
-       tf->tf_cs = context.sc_cs & 0xFFFF;
-       tf->tf_rsp = context.sc_esp;
-       tf->tf_ss = context.sc_ss & 0xFFFF;
-
-       mutex_enter(p->p_lock);
-       /* Restore signal stack. */
-       if (context.sc_onstack & SS_ONSTACK)
-               l->l_sigstk.ss_flags |= SS_ONSTACK;
-       else
-               l->l_sigstk.ss_flags &= ~SS_ONSTACK;
-       /* Restore signal mask. */
-       (void) sigprocmask1(l, SIG_SETMASK, &context.sc_mask, 0);
-       mutex_exit(p->p_lock);
-
-       return (EJUSTRETURN);
-}
-
-
 #ifdef COREDUMP
 /*
  * Dump the machine specific segment at the start of a core dump.
@@ -1028,17 +968,14 @@
 int netbsd32_amd64_init(int);
 int netbsd32_amd64_fini(int);
 
-int
-netbsd32_amd64_init(int misc)
+void
+netbsd32_machdep_md_init(void)
 {
 
        vec_netbsd32_sendsig = netbsd32_sendsig_siginfo;
-       return 0;
 }
 
-int
-netbsd32_amd64_fini(int misc)
+void
+netbsd32_machdep_md_fini(void)
 {
-
-       return 0;
 }
diff -r c82dec9cdc4d -r 09c9dd073e16 sys/arch/amd64/amd64/netbsd32_machdep_16.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep_16.c        Fri Sep 14 06:21:17 2018 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep_16.c        Fri Sep 14 08:38:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep_16.c,v 1.1.2.1 2018/09/14 05:37:08 pgoyette Exp $     */
+/*     $NetBSD: netbsd32_machdep_16.c,v 1.1.2.2 2018/09/14 08:38:37 pgoyette Exp $     */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep_16.c,v 1.1.2.1 2018/09/14 05:37:08 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep_16.c,v 1.1.2.2 2018/09/14 08:38:37 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -242,21 +242,16 @@
 
 extern void (*vec_netbsd32_sendsig)(const ksiginfo_t *, const sigset_t *);
 
-int netbsd32_amd64_16_init(int);
-int netbsd32_amd64_16_fini(int);
-
-int
-netbsd32_amd64_16_init(int misc)
+void
+netbsd32_machdep_md_16_init(void)
 {
 
        vec_netbsd32_sendsig = netbsd32_sendsig_16;
-       return 0;
 }
 
-int
-netbsd32_amd64_16_fini(int misc)
+void
+netbsd32_machdep_md_16_fini(void)
 {
 
        vec_netbsd32_sendsig = netbsd32_sendsig_siginfo;
-       return 0;
 }
diff -r c82dec9cdc4d -r 09c9dd073e16 sys/arch/amd64/conf/files.amd64
--- a/sys/arch/amd64/conf/files.amd64   Fri Sep 14 06:21:17 2018 +0000
+++ b/sys/arch/amd64/conf/files.amd64   Fri Sep 14 08:38:37 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.amd64,v 1.101.2.4 2018/09/06 06:55:24 pgoyette Exp $
+#      $NetBSD: files.amd64,v 1.101.2.5 2018/09/14 08:38:37 pgoyette Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -146,6 +146,8 @@
 # NetBSD/i386 32-bit binary compatibility (COMPAT_NETBSD32)
 include "compat/netbsd32/files.netbsd32"
 file   arch/amd64/amd64/netbsd32_machdep.c     compat_netbsd32
+file   arch/amd64/amd64/netbsd32_machdep_13.c  compat_netbsd32 & compat_13
+file   arch/amd64/amd64/netbsd32_machdep_16.c  compat_netbsd32 & compat_16
 file   arch/amd64/amd64/netbsd32_sigcode.S     compat_netbsd32 & compat_16
 file   arch/amd64/amd64/netbsd32_syscall.c     compat_netbsd32
 
diff -r c82dec9cdc4d -r 09c9dd073e16 sys/arch/xen/conf/files.xen
--- a/sys/arch/xen/conf/files.xen       Fri Sep 14 06:21:17 2018 +0000
+++ b/sys/arch/xen/conf/files.xen       Fri Sep 14 08:38:37 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.xen,v 1.165.2.5 2018/07/28 04:37:42 pgoyette Exp $
+#      $NetBSD: files.xen,v 1.165.2.6 2018/09/14 08:38:37 pgoyette Exp $
 #      NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #      NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -334,6 +334,8 @@
 # NetBSD/i386 32-bit binary compatibility (COMPAT_NETBSD32)
 include "compat/netbsd32/files.netbsd32"
 file   arch/amd64/amd64/netbsd32_machdep.c     compat_netbsd32
+file   arch/amd64/amd64/netbsd32_machdep_13.c  compat_netbsd32 & compat_13
+file   arch/amd64/amd64/netbsd32_machdep_16.c  compat_netbsd32 & compat_16
 file   arch/amd64/amd64/netbsd32_sigcode.S     compat_netbsd32 & compat_16
 file   arch/amd64/amd64/netbsd32_syscall.c     compat_netbsd32
 
diff -r c82dec9cdc4d -r 09c9dd073e16 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h    Fri Sep 14 06:21:17 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32.h    Fri Sep 14 08:38:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32.h,v 1.116.2.4 2018/09/11 21:18:32 pgoyette Exp $      */
+/*     $NetBSD: netbsd32.h,v 1.116.2.5 2018/09/14 08:38:37 pgoyette Exp $      */
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -1165,11 +1165,22 @@
 SYSCTL_SETUP_PROTO(netbsd32_sysctl_emul_setup);
 #endif /* SYSCTL_SETUP_PROTO */
 
+extern void (*vec_netbsd32_sendsig)(const ksiginfo_t *, const sigset_t *);
+
 /*
  * Finally, declare emul_netbsd32 as this is needed in lots of
  * places when calling syscall_{,dis}establish()
  */
 
 extern struct emul emul_netbsd32;
+extern char netbsd32_sigcode[], netbsd32_esigcode[];
+
+/*
+ * Prototypes for MD initialization routines
+ */
+void netbsd32_machdep_md_init(void);
+void netbsd32_machdep_md_fini(void);
+void netbsd32_machdep_md_16_init(void);
+void netbsd32_machdep_md_16_fini(void);
 
 #endif /* _COMPAT_NETBSD32_NETBSD32_H_ */
diff -r c82dec9cdc4d -r 09c9dd073e16 sys/compat/netbsd32/netbsd32_compat_16.c
--- a/sys/compat/netbsd32/netbsd32_compat_16.c  Fri Sep 14 06:21:17 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_16.c  Fri Sep 14 08:38:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_compat_16.c,v 1.1.2.2 2018/09/14 05:37:08 pgoyette Exp $      */
+/*     $NetBSD: netbsd32_compat_16.c,v 1.1.2.3 2018/09/14 08:38:37 pgoyette Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_16.c,v 1.1.2.2 2018/09/14 05:37:08 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_16.c,v 1.1.2.3 2018/09/14 08:38:37 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,39 +51,28 @@
 #include <compat/netbsd32/netbsd32_syscallargs.h>
 #include <compat/netbsd32/netbsd32_conv.h>
 
-extern char netbsd32_sigcode[], netbsd32_esigcode[];
 struct uvm_object *emul_netbsd32_object;
 
-#ifdef MACHDEP_INIT_PREF
-int __CONCAT(MACHDEP_INIT_PREF,_init)(int);
-int __CONCAT(MACHDEP_INIT_PREF,_fini)(int);
-#endif
-
 MODULE(MODULE_CLASS_EXEC, compat_netbsd32_16, "compat_netbsd32,compat_16");
 
 static int
 compat_netbsd32_16_modcmd(modcmd_t cmd, void *arg)
 {
-int error = 0;
 
        switch (cmd) {
        case MODULE_CMD_INIT:
                emul_netbsd32.e_sigcode = netbsd32_sigcode;
                emul_netbsd32.e_esigcode = netbsd32_esigcode;
                emul_netbsd32.e_sigobject = &emul_netbsd32_object;
-#ifdef MACHDEP_INIT_PREF
-               error = __CONCAT(MACHDEP_INIT_PREF,_init)(0);
-#endif
-               return error;
+               netbsd32_machdep_md_16_init();
+               return 0;
 
        case MODULE_CMD_FINI:
                emul_netbsd32.e_sigcode = NULL;
                emul_netbsd32.e_esigcode = NULL;
                emul_netbsd32.e_sigobject = NULL;
-#ifdef MACHDEP_INIT_PREF
-               error = __CONCAT(MACHDEP_INIT_PREF,_fini)(0);
-#endif
-               return error;
+               netbsd32_machdep_md_16_fini();
+               return 0;
 
        default:
                return ENOTTY;
diff -r c82dec9cdc4d -r 09c9dd073e16 sys/compat/netbsd32/netbsd32_mod.c
--- a/sys/compat/netbsd32/netbsd32_mod.c        Fri Sep 14 06:21:17 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_mod.c        Fri Sep 14 08:38:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_mod.c,v 1.13.16.10 2018/09/14 05:37:08 pgoyette Exp $ */
+/*     $NetBSD: netbsd32_mod.c,v 1.13.16.11 2018/09/14 08:38:37 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.13.16.10 2018/09/14 05:37:08 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.13.16.11 2018/09/14 08:38:37 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -102,11 +102,6 @@



Home | Main Index | Thread Index | Old Index