HardenedBSD/sys/arm64/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
_bus.h
_inttypes.h
_limits.h
_stdint.h
_types.h
acpica_machdep.h
armreg.h Add more arm64 special register values 2023-06-12 09:31:14 +01:00
asan.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
asm.h
atomic.h
bus_dma_impl.h
bus_dma.h
bus.h
clock.h
cmn600_reg.h
counter.h
cpu.h arm64: Add a masked get_kernel_reg() 2023-06-28 16:29:49 -04:00
cpufunc.h Consistently provide ffs/fls using builtins 2023-07-06 14:46:41 -03:00
csan.h
db_machdep.h
debug_monitor.h Make some arm64 debug monitor functions static 2023-07-05 11:05:38 +01:00
disassem.h
dump.h
efi.h
elf.h
endian.h
exec.h
float.h
floatingpoint.h
fpu.h
frame.h arm64: Remove struct arm64_frame 2023-06-15 12:38:45 -04:00
gdb_machdep.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
hypervisor.h
ieeefp.h
ifunc.h
in_cksum.h
intr.h arm: remove passing trapframe to intr_ipi_dispatch() 2023-04-26 20:08:30 +01:00
iodev.h
iommu.h
kdb.h
machdep.h
md_var.h arm64: add swapueword8/32 2023-05-11 13:23:14 -05:00
memdev.h
metadata.h
minidump.h
ofw_machdep.h
param.h
pcb.h Add padding for future use on arm64 2023-04-25 10:23:15 +01:00
pci_cfgreg.h
pcpu_aux.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
pcpu.h Use a uint64_t to store the arm64 mpidr 2023-04-24 12:33:50 +01:00
pmap.h pmap_{un}map_io_transient: Use bool instead of boolean_t. 2023-05-04 12:29:48 -07:00
pmc_mdep.h hwpmc: use kstack_contains() 2023-05-06 14:49:19 -03:00
proc.h Add padding for future use on arm64 2023-04-25 10:23:15 +01:00
procctl.h
profile.h
psl.h
pte.h arm64 pmap: introduce PHYS_TO_PTE macro 2023-05-24 11:55:38 +01:00
ptrace.h
reg.h
reloc.h
resource.h
runq.h
setjmp.h
sf_buf.h
sigframe.h
signal.h
smp.h smp: Dynamically allocate the stoppcbs array 2023-05-25 18:09:55 -04:00
stack.h
stdarg.h
sysarch.h
tls.h
trap.h
ucontext.h
undefined.h
vdso.h
vfp.h Add helpers to allocate an arm64 VFP state struct 2023-07-05 10:42:14 +01:00
vm.h
vmparam.h arm64: make VM_NFREEORDER and the comment describing it match 2023-06-29 12:48:48 -05:00