Module Name: src
Committed By: pgoyette
Date: Fri Sep 14 08:38:37 UTC 2018
Modified Files:
src/sys/arch/amd64/amd64 [pgoyette-compat]: netbsd32_machdep.c
netbsd32_machdep_16.c
src/sys/arch/amd64/conf [pgoyette-compat]: files.amd64
src/sys/arch/xen/conf [pgoyette-compat]: files.xen
src/sys/compat/netbsd32 [pgoyette-compat]: netbsd32.h
netbsd32_compat_16.c netbsd32_mod.c
src/sys/modules/compat_netbsd32 [pgoyette-compat]: Makefile
src/sys/modules/compat_netbsd32_16 [pgoyette-compat]: Makefile
Log Message:
OMG it builds!
Finish rearranging the amd64 MD compat_netbsd32 code.
XXX Other architectures will be dealt with later.
To generate a diff of this commit:
cvs rdiff -u -r1.115.2.2 -r1.115.2.3 \
src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/arch/amd64/amd64/netbsd32_machdep_16.c
cvs rdiff -u -r1.101.2.4 -r1.101.2.5 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.165.2.5 -r1.165.2.6 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.116.2.4 -r1.116.2.5 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/compat/netbsd32/netbsd32_compat_16.c
cvs rdiff -u -r1.13.16.10 -r1.13.16.11 src/sys/compat/netbsd32/netbsd32_mod.c
cvs rdiff -u -r1.20.12.11 -r1.20.12.12 \
src/sys/modules/compat_netbsd32/Makefile
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/modules/compat_netbsd32_16/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.115.2.2 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.115.2.3
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.115.2.2 Fri Sep 14 05:37:08 2018
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Fri Sep 14 08:38:37 2018
@@ -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 @@ netbsd32_sendsig(const ksiginfo_t *ksi,
(*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 @@ netbsd32_vm_default_addr(struct proc *p,
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;
}
Index: src/sys/arch/amd64/amd64/netbsd32_machdep_16.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep_16.c:1.1.2.1 src/sys/arch/amd64/amd64/netbsd32_machdep_16.c:1.1.2.2
--- src/sys/arch/amd64/amd64/netbsd32_machdep_16.c:1.1.2.1 Fri Sep 14 05:37:08 2018
+++ src/sys/arch/amd64/amd64/netbsd32_machdep_16.c Fri Sep 14 08:38:37 2018
@@ -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 @@ compat_16_netbsd32___sigreturn14(struct
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;
}
Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.101.2.4 src/sys/arch/amd64/conf/files.amd64:1.101.2.5
--- src/sys/arch/amd64/conf/files.amd64:1.101.2.4 Thu Sep 6 06:55:24 2018
+++ src/sys/arch/amd64/conf/files.amd64 Fri Sep 14 08:38:37 2018
@@ -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 @@ file arch/amd64/amd64/compat_16_machdep.
# 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
Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.165.2.5 src/sys/arch/xen/conf/files.xen:1.165.2.6
--- src/sys/arch/xen/conf/files.xen:1.165.2.5 Sat Jul 28 04:37:42 2018
+++ src/sys/arch/xen/conf/files.xen Fri Sep 14 08:38:37 2018
@@ -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 @@ file arch/amd64/amd64/compat_16_machdep.
# 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
Index: src/sys/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.116.2.4 src/sys/compat/netbsd32/netbsd32.h:1.116.2.5
--- src/sys/compat/netbsd32/netbsd32.h:1.116.2.4 Tue Sep 11 21:18:32 2018
+++ src/sys/compat/netbsd32/netbsd32.h Fri Sep 14 08:38:37 2018
@@ -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 @@ struct iovec *netbsd32_get_iov(struct ne
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_ */
Index: src/sys/compat/netbsd32/netbsd32_compat_16.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_16.c:1.1.2.2 src/sys/compat/netbsd32/netbsd32_compat_16.c:1.1.2.3
--- src/sys/compat/netbsd32/netbsd32_compat_16.c:1.1.2.2 Fri Sep 14 05:37:08 2018
+++ src/sys/compat/netbsd32/netbsd32_compat_16.c Fri Sep 14 08:38:37 2018
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com
#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;
Index: src/sys/compat/netbsd32/netbsd32_mod.c
diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.13.16.10 src/sys/compat/netbsd32/netbsd32_mod.c:1.13.16.11
--- src/sys/compat/netbsd32/netbsd32_mod.c:1.13.16.10 Fri Sep 14 05:37:08 2018
+++ src/sys/compat/netbsd32/netbsd32_mod.c Fri Sep 14 08:38:37 2018
@@ -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 @@ static struct execsw netbsd32_execsw[] =
#endif
};
-#ifdef MACHDEP_INIT_PREF
-int __CONCAT(MACHDEP_INIT_PREF,_init)(int);
-int __CONCAT(MACHDEP_INIT_PREF,_fini)(int);
-#endif
-
static int
compat_netbsd32_modcmd(modcmd_t cmd, void *arg)
{
@@ -114,36 +109,27 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi
switch (cmd) {
case MODULE_CMD_INIT:
- netbsd32_sysctl_init();
error = exec_add(netbsd32_execsw,
__arraycount(netbsd32_execsw));
- vec_compat32_80_modctl = compat32_80_modctl_compat_stub;
-#ifdef MACHDEP_INIT_PREF
- if (error == 0)
- error = __CONCAT(MACHDEP_INIT_PREF,_init)(0);
-#endif
- if (error != 0) {
- vec_compat32_80_modctl = (void *)enosys;
- netbsd32_sysctl_fini();
+ if (error == 0) {
+ netbsd32_sysctl_init();
+ vec_compat32_80_modctl = compat32_80_modctl_compat_stub;
+ netbsd32_machdep_md_init();
}
return error;
case MODULE_CMD_FINI:
-#ifdef MACHDEP_INIT_PREF
- error = __CONCAT(MACHDEP_INIT_PREF,_fini)(0);
- if (error)
- return error;
-#endif
+ netbsd32_machdep_md_fini();
vec_compat32_80_modctl = (void *)enosys;
+ netbsd32_sysctl_fini();
+
error = exec_remove(netbsd32_execsw,
__arraycount(netbsd32_execsw));
if (error) {
+ netbsd32_sysctl_init();
vec_compat32_80_modctl = compat32_80_modctl_compat_stub;
-#ifdef MACHDEP_INIT_PREF
- (void)__CONCAT(MACHDEP_INIT_PREF,_init)(0);
-#endif
- } else
- netbsd32_sysctl_fini();
+ netbsd32_machdep_md_init();
+ }
return error;
default:
Index: src/sys/modules/compat_netbsd32/Makefile
diff -u src/sys/modules/compat_netbsd32/Makefile:1.20.12.11 src/sys/modules/compat_netbsd32/Makefile:1.20.12.12
--- src/sys/modules/compat_netbsd32/Makefile:1.20.12.11 Fri Sep 14 05:37:08 2018
+++ src/sys/modules/compat_netbsd32/Makefile Fri Sep 14 08:38:37 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.20.12.11 2018/09/14 05:37:08 pgoyette Exp $
+# $NetBSD: Makefile,v 1.20.12.12 2018/09/14 08:38:37 pgoyette Exp $
.include "../Makefile.inc"
.include "../Makefile.assym"
@@ -44,13 +44,15 @@ SRCS+= netbsd32_exec_aout.c
.if ${MACHINE_ARCH} == "x86_64"
.PATH: ${S}/arch/amd64/amd64
CPPFLAGS+= -DMTRR
-CPPFLAGS+= -DMACHDEP_INIT_PREF=netbsd32_amd64
-SRCS+= netbsd32_machdep.c netbsd32_syscall.c
+SRCS+= netbsd32_syscall.c
.endif
.if ${MACHINE_ARCH} == "sparc64"
.PATH: ${S}/arch/sparc64/sparc64
-SRCS+= netbsd32_machdep.c netbsd32_sigcode.S
+SRCS+= netbsd32_sigcode.S
.endif
+.PATH: ${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}
+SRCS+= netbsd32_machdep.c
+
.include <bsd.kmodule.mk>
Index: src/sys/modules/compat_netbsd32_16/Makefile
diff -u src/sys/modules/compat_netbsd32_16/Makefile:1.1.2.2 src/sys/modules/compat_netbsd32_16/Makefile:1.1.2.3
--- src/sys/modules/compat_netbsd32_16/Makefile:1.1.2.2 Fri Sep 14 05:37:08 2018
+++ src/sys/modules/compat_netbsd32_16/Makefile Fri Sep 14 08:38:37 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.2 2018/09/14 05:37:08 pgoyette Exp $
+# $NetBSD: Makefile,v 1.1.2.3 2018/09/14 08:38:37 pgoyette Exp $
.include "../Makefile.inc"
.include "../Makefile.assym"
@@ -15,8 +15,10 @@ SRCS+= netbsd32_compat_16.c
.if ${MACHINE_ARCH} == "x86_64"
.PATH: ${S}/arch/amd64/amd64
-CPPFLAGS+= -DMACHDEP_INIT_PREF=netbsd32_amd64_16
-SRCS+= netbsd32_machdep_16.c netbsd32_sigcode.S
+SRCS+= netbsd32_sigcode.S
.endif
+.PATH: ${S}/${MACHINE_CPU}/${MACHINE_CPU}
+SRCS+= netbsd32_machdep_16.c
+
.include <bsd.kmodule.mk>