Module Name: src Committed By: martin Date: Thu Apr 18 15:24:21 UTC 2024
Modified Files: src/share/mk [netbsd-9]: bsd.own.mk src/sys/arch/aarch64/include [netbsd-9]: sljit_machdep.h src/sys/external/bsd/sljit/dist/sljit_src [netbsd-9]: sljitNativeARM_64.c src/sys/modules [netbsd-9]: Makefile Log Message: 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 (all via patch) 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. To generate a diff of this commit: cvs rdiff -u -r1.1149.2.6 -r1.1149.2.7 src/share/mk/bsd.own.mk cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/aarch64/include/sljit_machdep.h cvs rdiff -u -r1.4 -r1.4.4.1 \ src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c cvs rdiff -u -r1.222.2.1 -r1.222.2.2 src/sys/modules/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1149.2.6 src/share/mk/bsd.own.mk:1.1149.2.7 --- src/share/mk/bsd.own.mk:1.1149.2.6 Thu Feb 4 19:05:00 2021 +++ src/share/mk/bsd.own.mk Thu Apr 18 15:24:20 2024 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1149.2.6 2021/02/04 19:05:00 martin Exp $ +# $NetBSD: bsd.own.mk,v 1.1149.2.7 2024/04/18 15:24:20 martin Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -1169,6 +1169,25 @@ MKLLVMRT.i386= yes 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} + # # MK* options which default to "no". Note that MKZFS has a different # default for some platforms, see above. Please keep alphabetically @@ -1198,12 +1217,6 @@ _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 # to just Xnest and Xvfb.) Index: src/sys/arch/aarch64/include/sljit_machdep.h diff -u src/sys/arch/aarch64/include/sljit_machdep.h:1.2 src/sys/arch/aarch64/include/sljit_machdep.h:1.2.6.1 --- src/sys/arch/aarch64/include/sljit_machdep.h:1.2 Sun Dec 2 20:54:44 2018 +++ src/sys/arch/aarch64/include/sljit_machdep.h Thu Apr 18 15:24:20 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sljit_machdep.h,v 1.2 2018/12/02 20:54:44 alnsn Exp $ */ +/* $NetBSD: sljit_machdep.h,v 1.2.6.1 2024/04/18 15:24:20 martin Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -42,7 +42,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 Index: src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c:1.4 src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c:1.4.4.1 --- src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c:1.4 Sun Jan 20 23:14:16 2019 +++ src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c Thu Apr 18 15:24:21 2024 @@ -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.4.1 2024/04/18 15:24:21 martin Exp $ */ /* * Stack-less Just-In-Time compiler @@ -1079,7 +1079,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit 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_API_FUNC_ATTRIBUTE sljit_s32 sljit 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 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit 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_API_FUNC_ATTRIBUTE sljit_s32 sljit 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) { Index: src/sys/modules/Makefile diff -u src/sys/modules/Makefile:1.222.2.1 src/sys/modules/Makefile:1.222.2.2 --- src/sys/modules/Makefile:1.222.2.1 Sun Sep 1 13:00:37 2019 +++ src/sys/modules/Makefile Thu Apr 18 15:24:20 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.222.2.1 2019/09/01 13:00:37 martin Exp $ +# $NetBSD: Makefile,v 1.222.2.2 2024/04/18 15:24:20 martin Exp $ .include <bsd.own.mk> @@ -230,15 +230,9 @@ SUBDIR+= ubsec # Builds on architecture .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 # # ACPI modules