Thu Apr 18 15:21:55 2024 UTC (46d)
Pull up following revision(s) (requested by riastradh in ticket #655):
sys/modules/Makefile: revision 1.285
share/mk/bsd.own.mk: revision 1.1365
share/mk/bsd.own.mk: revision 1.1366
sys/arch/aarch64/include/sljit_machdep.h: revision 1.4
sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c: revision 1.5
sljit: Pacify -Wsign-compare.
If these sizes are negative, we're probably in trouble anyway, so
assert nonnegative here.
Needed to resolve PR 58103.
bsd.own.mk: Enable MKLSJIT on aarch64.
Make sure there's only one copy of the conditional, in bsd.own.mk;
just make sys/modules/Makefile conditional on MKSLJIT so we don't
have to keep these in sync.
As a workaround for PR 58106, tweak the conditional definition of
SLJIT_CACHE_FLUSH to use cpu_icache_sync_range only in _HARDKERNEL,
and use __builtin___clear_cache in userland and in rump kernels.
PR 58103: bpfjit.kmod is not built on aarch64
bsd.own.mk: No need for MKSLJIT to be set differently from others.
- Use ?=, not =, so mk.conf setting wins.
- Write out per-architecture tabular settings, not a conditional.
- Add comments for the architectures that look like they should have
sljit but don't. (XXX Missing comments about powerpc and mips --
not sure why, is this because modules don't yet work on those
architectures, or what?)
Tidying for PR 58103: bpfjit.kmod is not built on aarch64.
(martin)
diff -r1.1289.2.2 -r1.1289.2.3 src/share/mk/bsd.own.mk
diff -r1.3 -r1.3.18.1 src/sys/arch/aarch64/include/sljit_machdep.h
diff -r1.4 -r1.4.30.1 src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c
diff -r1.274.2.2 -r1.274.2.3 src/sys/modules/Makefile
--- src/share/mk/bsd.own.mk 2023/10/20 16:04:59 1.1289.2.2
+++ src/share/mk/bsd.own.mk 2024/04/18 15:21:55 1.1289.2.3
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.own.mk,v 1.1289.2.2 2023/10/20 16:04:59 martin Exp $
+# $NetBSD: bsd.own.mk,v 1.1289.2.3 2024/04/18 15:21:55 martin Exp $
# This needs to be before bsd.init.mk
.if defined(BSD_MK_COMPAT_FILE)
@@ -1285,6 +1285,21 @@
MKLLVMRT.aarch64= yes
.endif
+# Just-in-time compiler for bpf, npf acceleration
+MKSLJIT.aarch64= yes
+MKSLJIT.i386= yes
+MKSLJIT.sparc= yes
+#MKSLJIT.sparc64= yes # not suppored in sljit (yet?)
+MKSLJIT.x86_64= yes
+#MKSLJIT.powerpc= yes # XXX
+#MKSLJIT.powerpc64= yes # XXX
+#MKSLJIT.mipsel= yes # XXX
+#MKSLJIT.mipseb= yes # XXX
+#MKSLJIT.mips64el= yes # XXX
+#MKSLJIT.mips64eb= yes # XXX
+#MKSLJIT.riscv32= yes # not until we update sljit
+#MKSLJIT.riscv64= yes # not until we update sljit
+
# compat with old names
MKDEBUGKERNEL?=${MKKDEBUG:Uno}
MKDEBUGTOOLS?=${MKTOOLSDEBUG:Uno}
@@ -1317,12 +1332,6 @@
.for var in ${_MKVARS.no}
${var}?= ${${var}.${MACHINE_ARCH}:U${${var}.${MACHINE}:Uno}}
.endfor
-
-.if ${MACHINE_ARCH} == "i386" || \
- ${MACHINE_ARCH} == "x86_64" || \
- ${MACHINE_ARCH} == "sparc"
-MKSLJIT= yes
-.endif
#
# Which platforms build the xorg-server drivers (as opposed
--- src/sys/arch/aarch64/include/sljit_machdep.h 2020/12/11 18:03:33 1.3
+++ src/sys/arch/aarch64/include/sljit_machdep.h 2024/04/18 15:21:55 1.3.18.1
@@ -1,4 +1,4 @@
-/* $NetBSD: sljit_machdep.h,v 1.3 2020/12/11 18:03:33 skrll Exp $ */
+/* $NetBSD: sljit_machdep.h,v 1.3.18.1 2024/04/18 15:21:55 martin Exp $ */
/*-
* Copyright (c) 2014 Alexander Nasonov.
@@ -43,7 +43,12 @@
#define SLJIT_CONFIG_ARM_64 1
-#ifdef _KERNEL
+#ifdef _HARDKERNEL
+/*
+ * XXX Currently sys/rump/include/machine/cpu.h doesn't have
+ * ci_cpufuncs for cpu_icache_sync_range, so we do this only for
+ * non-rump kernels for now.
+ */
#define SLJIT_CACHE_FLUSH(from, to) \
cpu_icache_sync_range((vaddr_t)(from), (vsize_t)((to) - (from)))
#else
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c 2019/01/20 23:14:16 1.4
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c 2024/04/18 15:21:55 1.4.30.1
@@ -1,4 +1,4 @@
-/* $NetBSD: sljitNativeARM_64.c,v 1.4 2019/01/20 23:14:16 alnsn Exp $ */
+/* $NetBSD: sljitNativeARM_64.c,v 1.4.30.1 2024/04/18 15:21:55 martin Exp $ */
/*
* Stack-less Just-In-Time compiler
@@ -1079,7 +1079,8 @@
local_size = (local_size + 15) & ~0xf;
compiler->local_size = local_size;
- if (local_size <= (63 * sizeof(sljit_sw))) {
+ SLJIT_ASSERT(local_size >= 0);
+ if ((size_t)local_size <= (63 * sizeof(sljit_sw))) {
FAIL_IF(push_inst(compiler, STP_PRE | 29 | RT2(TMP_LR)
| RN(TMP_SP) | ((-(local_size >> 3) & 0x7f) << 15)));
FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RN(TMP_SP) | (0 << 10)));
@@ -1129,7 +1130,8 @@
SLJIT_ASSERT(prev == -1);
- if (compiler->local_size > (63 * sizeof(sljit_sw))) {
+ SLJIT_ASSERT(compiler->local_size >= 0);
+ if ((size_t)compiler->local_size > (63 * sizeof(sljit_sw))) {
/* The local_size is already adjusted by the saved registers. */
if (local_size > 0xfff) {
FAIL_IF(push_inst(compiler, SUBI | RD(TMP_SP) | RN(TMP_SP) | ((local_size >> 12) << 10) | (1 << 22)));
@@ -1179,7 +1181,8 @@
local_size = compiler->local_size;
saved_regs_size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 0);
- if (local_size <= (63 * sizeof(sljit_sw)))
+ SLJIT_ASSERT(local_size >= 0);
+ if ((size_t)local_size <= (63 * sizeof(sljit_sw)))
offs = (local_size - saved_regs_size) << (15 - 3);
else {
FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
@@ -1232,7 +1235,8 @@
SLJIT_ASSERT(prev == -1);
- if (compiler->local_size <= (63 * sizeof(sljit_sw))) {
+ SLJIT_ASSERT(compiler->local_size >= 0);
+ if ((size_t)compiler->local_size <= (63 * sizeof(sljit_sw))) {
FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
| RN(TMP_SP) | (((local_size >> 3) & 0x7f) << 15)));
} else if (saved_regs_size > 0) {
--- src/sys/modules/Makefile 2023/12/30 19:13:50 1.274.2.2
+++ src/sys/modules/Makefile 2024/04/18 15:21:55 1.274.2.3
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.274.2.2 2023/12/30 19:13:50 martin Exp $
+# $NetBSD: Makefile,v 1.274.2.3 2024/04/18 15:21:55 martin Exp $
.include <bsd.own.mk>
@@ -258,14 +258,8 @@
.endif
.if ${MKSLJIT} != "no"
-# No modules for 32-bit arm, mips and powerpc yet.
-.if ${MACHINE_ARCH} == "aarch64" || \
- ${MACHINE_ARCH} == "i386" || \
- ${MACHINE_ARCH} == "sparc" || \
- ${MACHINE_ARCH} == "x86_64"
SUBDIR+= bpfjit
SUBDIR+= sljit
-.endif
.endif
#