opnsense-src/sys/arm/include
Mitchell Horne a89262079e Consistently provide ffs/fls using builtins
Use of compiler builtin ffs/ctz functions will result in optimized
instruction sequences when possible, and fall back to calling a function
provided by the compiler run-time library. We have slowly shifted our
platforms to take advantage of these builtins in 60645781d6 (arm64),
1c76d3a9fb (arm), 9e319462a0 (powerpc, partial).

Some platforms still rely on the libkern implementations of these
functions provided by libkern, namely riscv, powerpc (ffs*, flsll), and
i386 (ffsll and flsll). These routines are slow, as they perform a
linear search for the bit in question. Even on platforms lacking
dedicated bit-search instructions, such as riscv, the compiler library
will provide better-optimized routines, e.g. by using binary search.

Consolidate all definitions of these functions (whether currently using
builtins or not) to libkern.h. This should result in equivalent or
better performing routines in all cases.

One wart in all of this is the existing HAVE_INLINE_F*** macros, which
we use in a few places to conditionally avoid the slow libkern routines.
These aren't easily removed in one commit. For now, provide these
defines unconditionally, but marked for removal after subsequent
cleanup.

Removal of the now unused libkern routines will follow in the next
commit.

Reviewed by:	dougm, imp (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40698
2023-07-06 14:46:41 -03:00
..
_align.h Remove the pre-ARMv6 and pre-INTRNG code. 2020-11-29 08:40:12 +00:00
_bus.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
_inttypes.h spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD 2023-05-12 10:44:04 -06:00
_limits.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
_stdint.h spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD 2023-05-12 10:44:04 -06:00
_types.h Reduce code duplication in machine/_types.h 2021-06-14 16:30:16 +01:00
acle-compat.h From https://sourceware.org/ml/newlib/2014/msg00113.html 2014-08-14 04:20:13 +00:00
armreg.h Remove checks for <sys/cdefs.h> being included. 2022-04-12 10:06:18 -07:00
asm.h Retire broken GPROF support from the kernel 2022-11-15 14:17:10 +00:00
asmacros.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
atags.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
atomic-v6.h arm: fix atomic_testand{set,clear}_64 for ops on high bits 2021-01-02 18:09:37 -08:00
atomic.h Remove now unused armv4 and not-INTRNG files. 2020-11-28 15:00:08 +00:00
blockio.h sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
bus.h Remove the pre-ARMv6 and pre-INTRNG code. 2020-11-29 08:40:12 +00:00
bus_dma.h spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD 2023-05-12 10:44:04 -06:00
clock.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
counter.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
cpu-v6.h Remove the pre-ARMv6 and pre-INTRNG code. 2020-11-29 08:40:12 +00:00
cpu.h armv6/legacy: optimize cpu_getcount performance 2022-03-14 07:51:21 +01:00
cpufunc.h Consistently provide ffs/fls using builtins 2023-07-06 14:46:41 -03:00
cpuinfo.h Remove the pre-ARMv6 and pre-INTRNG code. 2020-11-29 08:40:12 +00:00
db_machdep.h Remove the pre-ARMv6 and pre-INTRNG code. 2020-11-29 08:40:12 +00:00
debug_monitor.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
disassem.h sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
dump.h minidump: De-duplicate the progress bar 2021-09-29 16:42:21 -03:00
efi.h Fix building on i386 and arm. But 'public domain' headers on the files 2016-10-13 06:56:23 +00:00
elf.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
endian.h Consolidate machine/endian.h definitions 2021-03-26 19:00:22 -03:00
exec.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
fdt.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
fiq.h sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
float.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
floatingpoint.h spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
fpu.h arm: Add support for using VFP in kernel 2023-02-04 20:21:43 +01:00
frame.h arm: Remove obsolete comments 2021-10-27 09:44:58 -06:00
gdb_machdep.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
ieee.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ieeefp.h
in_cksum.h machine/in_cksum.h: don't include sys/cdefs.h 2022-04-18 21:02:19 +01:00
intr.h arm: remove passing trapframe to intr_ipi_dispatch() 2023-04-26 20:08:30 +01:00
kdb.h smp: Dynamically allocate the stoppcbs array 2023-05-25 18:09:55 -04:00
limits.h Remove checks for __CC_SUPPORTS_WARNING assuming it is always true. 2022-04-12 10:06:13 -07:00
machdep.h Remove unused functions and variables in cpufunc.[ch]. 2020-12-14 14:00:54 +00:00
md_var.h Simplify swi for bus_dma. 2021-12-28 13:51:25 -08:00
memdev.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
metadata.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
minidump.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
ofw_machdep.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
param.h Revert "arm: Bump KSTACK_PAGES default to match i386/amd64" 2021-09-01 13:13:27 -07:00
pcb.h arm: Add support for using VFP in kernel 2023-02-04 20:21:43 +01:00
pcpu.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
pcpu_aux.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
pl310.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
platform.h When the initarm_* routines were renamed to platform_* and moved to their 2014-08-17 02:56:58 +00:00
platformvar.h Use named field's initializer when constructing <foo>_platform structure. 2019-03-19 14:32:54 +00:00
pmap-v6.h sys: Consolidate common implementation details of PV entries. 2022-10-07 10:14:03 -07:00
pmap.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
pmap_var.h Don't use atomic operations for page table entries and handle access 2016-04-22 06:32:27 +00:00
pmc_mdep.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
proc.h Move kstack_contains() and GET_STACK_USAGE() to MD machine/stack.h 2023-02-02 00:59:26 +02:00
procctl.h amd64 KPTI: add control from procctl(2). 2019-03-16 11:44:33 +00:00
profile.h arm: clean up empty lines in .c and .h files 2020-09-01 21:17:24 +00:00
psl.h sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
pte-v6.h Fix TEX index acquisition using L2 attributes 2017-07-27 23:14:17 +00:00
ptrace.h arm: clean up empty lines in .c and .h files 2020-09-01 21:17:24 +00:00
reg.h arm: Add support for using VFP in kernel 2023-02-04 20:21:43 +01:00
reloc.h spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
resource.h ARM: Define PCI_RES_BUS resource for platforms having NEW_PCIB enabled. 2015-12-02 14:24:14 +00:00
runq.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
sc_machdep.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
setjmp.h arm: Remove a double word in a comment in setjmp 2023-04-13 20:37:25 +02:00
sf_buf.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
sigframe.h
signal.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
smp.h smp: Dynamically allocate the stoppcbs array 2023-05-25 18:09:55 -04:00
stack.h kstack_contains(): account for struct pcb on stack 2023-02-02 00:59:27 +02:00
stdarg.h Introduce an architecture-agnostic <sys/_stdarg.h> to reduce 2017-12-25 20:54:00 +00:00
swi.h arm: clean up empty lines in .c and .h files 2020-09-01 21:17:24 +00:00
sysarch.h Remove the pre-ARMv6 and pre-INTRNG code. 2020-11-29 08:40:12 +00:00
sysreg.h Remove the pre-ARMv6 and pre-INTRNG code. 2020-11-29 08:40:12 +00:00
tls.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
trap.h Move the check to see if we are tracing a function with the DTrace Function 2015-12-05 09:32:36 +00:00
ucontext.h spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD 2023-05-12 10:44:04 -06:00
undefined.h arm: clean up empty lines in .c and .h files 2020-09-01 21:17:24 +00:00
vdso.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
vfp.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
vm.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
vmparam.h arm: revert MAXDSIZ change from 202aea9c82 2021-01-09 14:14:00 -06:00