Source-Changes-HG archive

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

[src/trunk]: src/sys don't assume _LP64 == supports COMPAT_NETBSD32.



details:   https://anonhg.NetBSD.org/src/rev/aaf4bd3b5063
branches:  trunk
changeset: 996568:aaf4bd3b5063
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Feb 04 21:57:47 2019 +0000

description:
don't assume _LP64 == supports COMPAT_NETBSD32.

this is not true for alpha, ia64 and arm32 ports, and the first two
were not building because of it, and the latter would be missing
the oabi support (likely not a big deal, but still wrong.)

add a makefile fragment that tells you if it is supported and include
it where needed to define COMPAT_NETBSD32 when building the normal
kernel (ie, modules & rump.)


fixes alpha build, probably fixes ia64 build.


XXX: still leaves some netbsd32 code in rf_netbsdkintf.c, that should
     be moved into some hooks, but first the configuration setup
     needs to be moved into a common function the netbsd32 code can
     call into, vs living in the switch case itself.

diffstat:

 sys/compat/netbsd32/netbsd32.mk        |  13 +++++++++++++
 sys/dev/raidframe/rf_netbsdkintf.c     |  24 +++++++++++-------------
 sys/modules/Makefile                   |  12 ++++++------
 sys/modules/raid/Makefile              |   7 ++++++-
 sys/rump/dev/lib/libraidframe/Makefile |   7 ++++++-
 5 files changed, 42 insertions(+), 21 deletions(-)

diffs (181 lines):

diff -r 94efa759e866 -r aaf4bd3b5063 sys/compat/netbsd32/netbsd32.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/netbsd32/netbsd32.mk   Mon Feb 04 21:57:47 2019 +0000
@@ -0,0 +1,13 @@
+#      $NetBSD: netbsd32.mk,v 1.1 2019/02/04 21:57:47 mrg Exp $
+
+# makefile fragment that tells you if you should support netbsd32 or not.
+# include this and check ${COMPAT_USE_NETBSD32} != "no".
+
+.if ${MACHINE_ARCH} == "x86_64" \
+    || ${MACHINE_CPU} == "arm" \
+    || ${MACHINE_ARCH} == "sparc64" \
+    || (!empty(MACHINE_ARCH:Mmips64*) && !defined(BSD_MK_COMPAT_FILE))
+COMPAT_USE_NETBSD32?=yes
+.else
+COMPAT_USE_NETBSD32?=no
+.endif
diff -r 94efa759e866 -r aaf4bd3b5063 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Mon Feb 04 18:14:53 2019 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Mon Feb 04 21:57:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.362 2019/02/03 11:03:53 martin Exp $      */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.363 2019/02/04 21:57:47 mrg Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,10 +101,11 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.362 2019/02/03 11:03:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.363 2019/02/04 21:57:47 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
+#include "opt_compat_netbsd32.h"
 #endif
 
 #include <sys/param.h>
@@ -150,10 +151,7 @@
 
 #include "rf_compat80.h"
 
-#ifdef _LP64
-#ifndef COMPAT_NETBSD32
-#define COMPAT_NETBSD32        1
-#endif
+#ifdef COMPAT_NETBSD32
 #include "rf_compat32.h"
 #endif
 
@@ -1112,7 +1110,7 @@
        case RAIDFRAME_PARITYMAP_GET_DISABLE:
        case RAIDFRAME_PARITYMAP_SET_DISABLE:
        case RAIDFRAME_PARITYMAP_SET_PARAMS:
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
        case RAIDFRAME_GET_INFO32:
 #endif
                if ((rs->sc_flags & RAIDF_INITED) == 0)
@@ -1162,7 +1160,7 @@
 
                /* configure the system */
        case RAIDFRAME_CONFIGURE:
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
        case RAIDFRAME_CONFIGURE32:
 #endif
 
@@ -1179,7 +1177,7 @@
                if (k_cfg == NULL) {
                        return (ENOMEM);
                }
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
                if (cmd == RAIDFRAME_CONFIGURE32 &&
                    (l->l_proc->p_flag & PK_32) != 0)
                        MODULE_CALL_HOOK(raidframe_netbsd32_config_hook,
@@ -1487,21 +1485,21 @@
                return(retcode);
 
        case RAIDFRAME_GET_INFO:
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
        case RAIDFRAME_GET_INFO32:
-#endif /* LP64 */
+#endif
                RF_Malloc(d_cfg, sizeof(RF_DeviceConfig_t),
                          (RF_DeviceConfig_t *));
                if (d_cfg == NULL)
                        return (ENOMEM);
                retcode = rf_get_info(raidPtr, d_cfg);
                if (retcode == 0) {
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
                        if (raidframe_netbsd32_config_hook.hooked &&
                            cmd == RAIDFRAME_GET_INFO32)
                                ucfgp = NETBSD32PTR64(*(netbsd32_pointer_t *)data);
                        else
-#endif /* _LP64 */
+#endif
                                ucfgp = *(RF_DeviceConfig_t **)data;
                        retcode = copyout(d_cfg, ucfgp, sizeof(RF_DeviceConfig_t));
                }
diff -r 94efa759e866 -r aaf4bd3b5063 sys/modules/Makefile
--- a/sys/modules/Makefile      Mon Feb 04 18:14:53 2019 +0000
+++ b/sys/modules/Makefile      Mon Feb 04 21:57:47 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.217 2019/02/03 08:02:25 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.218 2019/02/04 21:57:48 mrg Exp $
 
 .include <bsd.own.mk>
 
@@ -272,10 +272,9 @@
 SUBDIR+=       wmimsi
 .endif
 
-.if ${MACHINE_ARCH} == "x86_64" \
-    || ${MACHINE_CPU} == "arm" \
-    || ${MACHINE_ARCH} == "sparc64" \
-    || (!empty(MACHINE_ARCH:Mmips64*) && !defined(BSD_MK_COMPAT_FILE))
+.include "${.CURDIR}/../compat/netbsd32/netbsd32.mk"
+.if ${COMPAT_USE_NETBSD32} != "no"
+
 SUBDIR+=       compat_netbsd32
 SUBDIR+=       compat_netbsd32_09      compat_netbsd32_12
 SUBDIR+=       compat_netbsd32_13      compat_netbsd32_16
@@ -291,12 +290,13 @@
 SUBDIR+=       compat_netbsd32_sysvipc_14
 SUBDIR+=       compat_netbsd32_sysvipc_50
 SUBDIR+=       compat_netbsd32_raid
-.endif
 
 .if ${MACHINE_ARCH} == "x86_64"
 SUBDIR+=       compat_linux32
 .endif
 
+.endif
+
 .if ${MACHINE_ARCH} == "i386"
 SUBDIR+=       ati_pcigart
 SUBDIR+=       compat_freebsd
diff -r 94efa759e866 -r aaf4bd3b5063 sys/modules/raid/Makefile
--- a/sys/modules/raid/Makefile Mon Feb 04 18:14:53 2019 +0000
+++ b/sys/modules/raid/Makefile Mon Feb 04 21:57:47 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2019/02/03 09:32:07 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.5 2019/02/04 21:57:48 mrg Exp $
 
 .include "../Makefile.inc"
 
@@ -41,4 +41,9 @@
 CPPFLAGS+=     -DRF_INCLUDE_PARITY_DECLUSTERING=1
 CPPFLAGS+=     -DRF_INCLUDE_PARITY_DECLUSTERING_DS=1
 
+.include "${.CURDIR}/../../compat/netbsd32/netbsd32.mk"
+.if ${COMPAT_USE_NETBSD32} != "no"
+CPPFLAGS.rf_netbsdkintf.c+=    -DCOMPAT_NETBSD32
+.endif
+
 .include <bsd.kmodule.mk>
diff -r 94efa759e866 -r aaf4bd3b5063 sys/rump/dev/lib/libraidframe/Makefile
--- a/sys/rump/dev/lib/libraidframe/Makefile    Mon Feb 04 18:14:53 2019 +0000
+++ b/sys/rump/dev/lib/libraidframe/Makefile    Mon Feb 04 21:57:47 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.11 2018/01/18 00:32:49 mrg Exp $
+#      $NetBSD: Makefile,v 1.12 2019/02/04 21:57:48 mrg Exp $
 #
 
 .PATH: ${.CURDIR}/../../../../dev/raidframe
@@ -35,5 +35,10 @@
 SRCS+= rf_compat80.c
 .endif
 
+.include "${.CURDIR}/../../../../compat/netbsd32/netbsd32.mk"
+.if ${COMPAT_USE_NETBSD32} != "no"
+CPPFLAGS.rf_netbsdkintf.c+=    -DCOMPAT_NETBSD32
+.endif
+
 .include <bsd.lib.mk>
 .include <bsd.klinks.mk>



Home | Main Index | Thread Index | Old Index