opnsense-src/sys/i386/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
..
pc spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
xen xen/intr: introduce dev/xen/bus/intr-internal.h 2023-04-14 15:58:53 +02:00
_align.h
_bus.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
_inttypes.h
_limits.h
_stdint.h
_types.h
acpica_machdep.h
apm_bios.h
apm_segments.h
asm.h Add CFI start/end proc directives to arm64, i386, and ppc 2020-12-05 00:33:28 +00:00
asmacros.h elfnote: place note in a PT_NOTE program header 2022-06-28 09:51:57 +02:00
atomic.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
bootinfo.h i386: Make boot loader smaller by reducing size of bootinfo 2022-09-16 09:18:57 -06:00
bus.h
bus_dma.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
clock.h x86: Deduplicate clock.h 2021-12-06 10:39:08 -05:00
counter.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
cpu.h i386 machine/cpu.h: include sys/systm.h for cpu_ticks() 2022-09-01 13:54:00 +02:00
cpufunc.h Consistently provide ffs/fls using builtins 2023-07-06 14:46:41 -03:00
cputypes.h
db_machdep.h Create sys/reg.h for the common code previously in machine/reg.h 2021-08-30 12:50:53 +01:00
dump.h
efi.h
elan_mmcr.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
elf.h
endian.h
exec.h
fdt.h
float.h
floatingpoint.h
fpu.h Add a <machine/fpu.h> for i386 that includes <machine/npx.h>. 2020-10-13 17:26:12 +00:00
frame.h
gdb_machdep.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
ieeefp.h Remove checks for __GNUCLIKE_ASM assuming it is always true. 2022-04-12 10:05:45 -07:00
in_cksum.h Remove checks for __GNUCLIKE_ASM assuming it is always true. 2022-04-12 10:05:45 -07:00
intr_machdep.h
iodev.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
iommu.h Add a per-each macro IOMMU_DOMAIN_UNLOAD_SLEEP which allows to sleep 2020-10-14 14:51:11 +00: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
md_var.h amd64: Eliminate write only cpu_fxsr. 2023-02-01 18:17:06 +03:00
memdev.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
metadata.h
minidump.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
nexusvar.h
npx.h Add support for FPU_KERN_NOCTX. 2020-10-13 17:27:37 +00:00
ofw_machdep.h
param.h i386: clean up empty lines in .c and .h files 2020-09-01 21:19:39 +00:00
pcb.h Fix for mis-interpretation of PCB_KERNFPU. 2020-10-14 23:01:41 +00:00
pcb_ext.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
pci_cfgreg.h
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
perfmon.h i386: clean up empty lines in .c and .h files 2020-09-01 21:19:39 +00:00
pmap.h amd64: fix PKRU and swapout interaction 2023-04-15 02:53:59 +03:00
pmap_base.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
pmap_nopae.h i386 PAE: avoid atomic for pte_store() where possible. 2019-02-26 09:45:44 +00:00
pmap_pae.h i386 PAE: avoid atomic for pte_store() where possible. 2019-02-26 09:45:44 +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 Remove checks for __GNUCLIKE_ASM assuming it is always true. 2022-04-12 10:05:45 -07:00
psl.h
ptrace.h
pvclock.h
reg.h
reloc.h
resource.h
runq.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
segments.h
setjmp.h
sf_buf.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
sigframe.h Rename struct sigframe4 to struct freebsd4_sigframe. 2022-01-13 17:16:50 -08:00
signal.h
smapi.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
smp.h amd64: allow parallel shootdown IPIs 2020-07-14 20:37:50 +00:00
speaker.h Remove checks for __CC_SUPPORTS_WARNING assuming it is always true. 2022-04-12 10:06:13 -07:00
specialreg.h
stack.h i386 kstack_contains(): account for pcb/fpu save area 2023-02-02 00:59:26 +02:00
stdarg.h
sysarch.h
tls.h Add <machine/tls.h> header to hold MD constants and helpers for TLS. 2021-12-09 13:17:13 -08:00
trap.h
tss.h
ucontext.h Move struct freebsd4_ucontext to sys/i386/include/ucontext.h. 2022-01-13 17:17:43 -08:00
vdso.h
vm.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
vm86.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
vmparam.h Add a vmparam.h constant indicating pmap support for large pages. 2020-09-23 19:34:21 +00:00