Source-Changes-HG archive

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

[src/trunk]: src/sys/lkm/compat add build glue for supported emulations



details:   https://anonhg.NetBSD.org/src/rev/2b77b6846f9a
branches:  trunk
changeset: 500231:2b77b6846f9a
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Dec 08 20:15:11 2000 +0000

description:
add build glue for supported emulations
since only linux compat on i386 is installed, only that LKM is actually
installed (LKMs are build for all platforms as appropriate though)
further changes to compat code would need to happen to make this usable
also for other plaforms or emulations

diffstat:

 sys/lkm/compat/Makefile                |   45 ++++++++++--
 sys/lkm/compat/Makefile.inc            |   17 ++++-
 sys/lkm/compat/aout/Makefile           |   19 +++++
 sys/lkm/compat/aout/lkminit_emul.c     |   83 ++++++++++++++++++++++++
 sys/lkm/compat/aoutm68k/Makefile       |   21 ++++++
 sys/lkm/compat/aoutm68k/lkminit_emul.c |   83 ++++++++++++++++++++++++
 sys/lkm/compat/freebsd/Makefile        |   23 ++++--
 sys/lkm/compat/freebsd/lkminit_emul.c  |   15 +--
 sys/lkm/compat/hpux/Makefile           |   26 +++++++
 sys/lkm/compat/hpux/lkminit_emul.c     |   68 ++++++++++++++++++++
 sys/lkm/compat/ibcs2/Makefile          |   26 +++++++
 sys/lkm/compat/ibcs2/lkminit_emul.c    |   66 +++++++++++++++++++
 sys/lkm/compat/linux/Makefile          |   56 ++++++++++++++--
 sys/lkm/compat/linux/lkminit_emul.c    |   65 +++++++++++++++++++
 sys/lkm/compat/linux/lkminit_linux.c   |  112 ---------------------------------
 sys/lkm/compat/netbsd32/Makefile       |   25 +++++++
 sys/lkm/compat/netbsd32/lkminit_emul.c |   68 ++++++++++++++++++++
 sys/lkm/compat/osf1/Makefile           |   29 ++++++++
 sys/lkm/compat/osf1/lkminit_emul.c     |   68 ++++++++++++++++++++
 sys/lkm/compat/sunos/Makefile          |   18 ++++-
 sys/lkm/compat/sunos/lkminit_emul.c    |   14 +--
 sys/lkm/compat/svr4/Makefile           |   25 +++++--
 sys/lkm/compat/svr4/lkminit_emul.c     |   17 +---
 sys/lkm/compat/ultrix/Makefile         |   25 +++++++
 sys/lkm/compat/ultrix/lkminit_emul.c   |   68 ++++++++++++++++++++
 25 files changed, 903 insertions(+), 179 deletions(-)

diffs (truncated from 1286 to 300 lines):

diff -r 87d9fa0d7471 -r 2b77b6846f9a sys/lkm/compat/Makefile
--- a/sys/lkm/compat/Makefile   Fri Dec 08 20:08:43 2000 +0000
+++ b/sys/lkm/compat/Makefile   Fri Dec 08 20:15:11 2000 +0000
@@ -1,21 +1,46 @@
-# $NetBSD: Makefile,v 1.5 1997/02/18 15:31:51 scottr Exp $
+# $NetBSD: Makefile,v 1.6 2000/12/08 20:15:11 jdolecek Exp $
+
+# XXX for now, only Linux on i386 was actually tested, others might
+# need further work; compile stuff on everything, but only install
+# compat_linux on i386
+.if make(install)
+.if (${MACHINE} == "i386")
+SUBDIR+=       linux
+.endif
+.else # !install
+
+.if (${MACHINE} == "alpha")
+SUBDIR+=       linux osf1
+.endif
 
-#
-# XXX  the compat LKMs are currently broken.
-#
-.if 0
+.if (${MACHINE} == "hp300")
+SUBDIR+=       hpux
+.endif
+
 .if (${MACHINE} == "i386")
-SUBDIR+=       freebsd linux
+SUBDIR+=       aout freebsd ibcs2 linux svr4
+.endif
+
+.if (${MACHINE_ARCH} == "m68k")
+SUBDIR+=       aoutm68k linux sunos svr4
+.endif
+
+.if (${MACHINE_ARCH} == "mipsle" || ${MACHINE_ARCH} == "mipsbe")
+SUBDIR+=       ultrix
 .endif
 
 .if (${MACHINE} == "sparc")
-SUBDIR+=       sunos svr4
+SUBDIR+=       aout sunos svr4
+.endif
+
+.if (${MACHINE_ARCH} == "sparc64")
+SUBDIR+=       netbsd32 sunos svr4
 .endif
 
-.if (${MACHINE_ARCH} == "m68k")
-SUBDIR+=       sunos
-.endif
+.if (${MACHINE_ARCH} == "vax")
+SUBDIR+=       ibcs2 ultrix
 .endif
 
+.endif # target(install)
 
 .include <bsd.subdir.mk>
diff -r 87d9fa0d7471 -r 2b77b6846f9a sys/lkm/compat/Makefile.inc
--- a/sys/lkm/compat/Makefile.inc       Fri Dec 08 20:08:43 2000 +0000
+++ b/sys/lkm/compat/Makefile.inc       Fri Dec 08 20:15:11 2000 +0000
@@ -1,5 +1,20 @@
-#      $NetBSD: Makefile.inc,v 1.3 1998/03/28 23:58:44 thorpej Exp $
+#      $NetBSD: Makefile.inc,v 1.4 2000/12/08 20:15:12 jdolecek Exp $
 
 S!=    cd ${.CURDIR}/../../..;pwd
 
+DPSRCS+= assym.h
+
+.if exists($S/arch/${MACHINE}/${MACHINE}/genassym.cf)
+GENASSYM_DIR?= $S/arch/${MACHINE}/${MACHINE}
+.elif exists($S/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/genassym.cf)
+GENASSYM_DIR?= $S/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
+.else
+GENASSYM_DIR?=
+.endif
+
+assym.h: ${S}/kern/genassym.sh ${GENASSYM_DIR}/genassym.cf
+       sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
+               < ${GENASSYM_DIR}/genassym.cf > assym.h.tmp && \
+       mv -f assym.h.tmp assym.h
+
 .include "../Makefile.inc"
diff -r 87d9fa0d7471 -r 2b77b6846f9a sys/lkm/compat/aout/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lkm/compat/aout/Makefile      Fri Dec 08 20:15:11 2000 +0000
@@ -0,0 +1,19 @@
+#      $NetBSD: Makefile,v 1.1 2000/12/08 20:15:13 jdolecek Exp $
+
+.include "../Makefile.inc"
+
+.PATH: $S/compat/aout
+
+CPPFLAGS+=     -DVM86 -DSYSVSEM -DSYSVMSG -DSYSVSHM -DCOMPAT_AOUT
+CPPFLAGS+=     -nostdinc
+AFLAGS=         -x assembler-with-cpp -traditional-cpp -D_LOCORE -D_KERNEL \
+                -I. -I${S}
+
+MKMAN= no
+
+KMOD=  compat_aout
+
+SRCS=  lkminit_emul.c
+SRCS+= aout_exec.c aout_misc.c aout_syscalls.c aout_sysent.c
+
+.include <bsd.kmod.mk>
diff -r 87d9fa0d7471 -r 2b77b6846f9a sys/lkm/compat/aout/lkminit_emul.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lkm/compat/aout/lkminit_emul.c        Fri Dec 08 20:15:11 2000 +0000
@@ -0,0 +1,83 @@
+/* $NetBSD: lkminit_emul.c,v 1.1 2000/12/08 20:15:13 jdolecek Exp $ */
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Michael Graff <explorer%flame.org@localhost>.
+ *
+ * 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 the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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/ioctl.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/mount.h>
+#include <sys/exec.h>
+#include <sys/exec_aout.h>
+#include <sys/lkm.h>
+#include <sys/file.h>
+#include <sys/errno.h>
+#include <sys/proc.h>
+
+/*
+ * This module is different to other compat modules - it adds the
+ * execsw[] entry as well. As the compat_aout is emulation more of
+ * executable format support, it's probably better to be placed here\
+ * than under lkm/exec/.
+ */
+
+extern const struct emul emul_netbsd_aout;
+
+int compat_aout_lkmentry __P((struct lkm_table *, int, int));
+
+static struct execsw exec_netbsd_aout =
+       { sizeof(struct exec), exec_aout_makecmds, { NULL },
+         &emul_netbsd_aout,
+         EXECSW_PRIO_FIRST,    /* Note: this differs from exec_conf.c entry */
+         0, copyargs, setregs };       /* a.out binaries */
+
+/*
+ * declare the executable format
+ */
+MOD_EXEC("compat_aout", -1, &exec_netbsd_aout, "aout");
+
+/*
+ * entry point
+ */
+int
+compat_aout_lkmentry(lkmtp, cmd, ver)
+       struct lkm_table *lkmtp;        
+       int cmd;
+       int ver;
+{
+       DISPATCH(lkmtp, cmd, ver, lkm_nofunc, lkm_nofunc, lkm_nofunc);
+}
diff -r 87d9fa0d7471 -r 2b77b6846f9a sys/lkm/compat/aoutm68k/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lkm/compat/aoutm68k/Makefile  Fri Dec 08 20:15:11 2000 +0000
@@ -0,0 +1,21 @@
+#      $NetBSD: Makefile,v 1.1 2000/12/08 20:15:13 jdolecek Exp $
+
+.include "../Makefile.inc"
+
+.PATH: $S/compat/aoutm68k
+
+CPPFLAGS+=     -DVM86 -DSYSVSEM -DSYSVMSG -DSYSVSHM -DCOMPAT_AOUT_M68K \
+               -DCOMPAT_43
+CPPFLAGS+=     -nostdinc
+AFLAGS=         -x assembler-with-cpp -traditional-cpp -D_LOCORE -D_KERNEL \
+                -I. -I${S}
+
+MKMAN= no
+
+KMOD=  compat_aoutm68k
+
+SRCS=  lkminit_emul.c
+SRCS+= aoutm68k_exec.c aoutm68k_ioctl.c aoutm68k_misc.c aoutm68k_stat.c \
+       aoutm68k_syscalls.c aoutm68k_sysent.c
+
+.include <bsd.kmod.mk>
diff -r 87d9fa0d7471 -r 2b77b6846f9a sys/lkm/compat/aoutm68k/lkminit_emul.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lkm/compat/aoutm68k/lkminit_emul.c    Fri Dec 08 20:15:11 2000 +0000
@@ -0,0 +1,83 @@
+/* $NetBSD: lkminit_emul.c,v 1.1 2000/12/08 20:15:14 jdolecek Exp $ */
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Michael Graff <explorer%flame.org@localhost>.
+ *
+ * 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 the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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/ioctl.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/mount.h>
+#include <sys/exec.h>
+#include <sys/exec_aout.h>
+#include <sys/lkm.h>
+#include <sys/file.h>
+#include <sys/errno.h>
+#include <sys/proc.h>
+
+/*
+ * This module is different to other compat modules - it adds the
+ * execsw[] entry as well. As the compat_aoutm68k is emulation more of
+ * executable format support, it's probably better to be placed here
+ * than under lkm/exec/.
+ */
+
+extern const struct emul emul_netbsd_aoutm68k;
+
+int compat_aoutm68k_lkmentry __P((struct lkm_table *, int, int));
+
+static struct execsw exec_netbsd_aoutm68k =
+       { sizeof(struct exec), exec_aout_makecmds, { NULL },
+         &emul_netbsd_aoutm68k,
+         EXECSW_PRIO_FIRST,    /* Note: this differs from exec_conf.c entry */
+         0, copyargs, setregs };       /* a.out binaries */
+
+/*
+ * declare the executable format
+ */
+MOD_EXEC("compat_aoutm68k", -1, &exec_netbsd_aoutm68k, "aoutm68k");
+
+/*
+ * entry point
+ */
+int



Home | Main Index | Thread Index | Old Index