Module Name: src
Committed By: mrg
Date: Mon Feb 4 21:57:48 UTC 2019
Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c
src/sys/modules: Makefile
src/sys/modules/raid: Makefile
src/sys/rump/dev/lib/libraidframe: Makefile
Added Files:
src/sys/compat/netbsd32: netbsd32.mk
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/compat/netbsd32/netbsd32.mk
cvs rdiff -u -r1.362 -r1.363 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.217 -r1.218 src/sys/modules/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/modules/raid/Makefile
cvs rdiff -u -r1.11 -r1.12 src/sys/rump/dev/lib/libraidframe/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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.362 src/sys/dev/raidframe/rf_netbsdkintf.c:1.363
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.362 Sun Feb 3 11:03:53 2019
+++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon Feb 4 21:57:47 2019
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkin
#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 @@ raidioctl(dev_t dev, u_long cmd, void *d
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 @@ raidioctl(dev_t dev, u_long cmd, void *d
/* configure the system */
case RAIDFRAME_CONFIGURE:
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
case RAIDFRAME_CONFIGURE32:
#endif
@@ -1179,7 +1177,7 @@ raidioctl(dev_t dev, u_long cmd, void *d
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 @@ raidioctl(dev_t dev, u_long cmd, void *d
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));
}
Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.217 src/sys/modules/Makefile:1.218
--- src/sys/modules/Makefile:1.217 Sun Feb 3 08:02:25 2019
+++ src/sys/modules/Makefile Mon Feb 4 21:57:48 2019
@@ -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+= wmihp
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_10
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
Index: src/sys/modules/raid/Makefile
diff -u src/sys/modules/raid/Makefile:1.4 src/sys/modules/raid/Makefile:1.5
--- src/sys/modules/raid/Makefile:1.4 Sun Feb 3 09:32:07 2019
+++ src/sys/modules/raid/Makefile Mon Feb 4 21:57:48 2019
@@ -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_INTERDECLUSTER=1
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>
Index: src/sys/rump/dev/lib/libraidframe/Makefile
diff -u src/sys/rump/dev/lib/libraidframe/Makefile:1.11 src/sys/rump/dev/lib/libraidframe/Makefile:1.12
--- src/sys/rump/dev/lib/libraidframe/Makefile:1.11 Thu Jan 18 00:32:49 2018
+++ src/sys/rump/dev/lib/libraidframe/Makefile Mon Feb 4 21:57:48 2019
@@ -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_compat50.c
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>
Added files:
Index: src/sys/compat/netbsd32/netbsd32.mk
diff -u /dev/null src/sys/compat/netbsd32/netbsd32.mk:1.1
--- /dev/null Mon Feb 4 21:57:48 2019
+++ src/sys/compat/netbsd32/netbsd32.mk Mon Feb 4 21:57:47 2019
@@ -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