mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Implement the ffs and fls functions, and their longer counterparts, in
cpufunc, in terms of __builtin_ffs and the like, for arm32 v6 and v7 architectures, and use those, rather than the simple libkern implementations, in building arm32 kernels. Reviewed by: manu Approved by: kib, markj (mentors) Tested by: iz-rpi03_hs-karlsruhe.de, mikael.urankar_gmail.com, ian Differential Revision: https://reviews.freebsd.org/D20412
This commit is contained in:
parent
de25327313
commit
1c76d3a9fb
2 changed files with 64 additions and 6 deletions
|
|
@ -359,6 +359,64 @@ extern u_int arm_cache_level;
|
||||||
extern u_int arm_cache_loc;
|
extern u_int arm_cache_loc;
|
||||||
extern u_int arm_cache_type[14];
|
extern u_int arm_cache_type[14];
|
||||||
|
|
||||||
|
#if __ARM_ARCH >= 6
|
||||||
|
#define HAVE_INLINE_FFS
|
||||||
|
|
||||||
|
static __inline __pure2 int
|
||||||
|
ffs(int mask)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (__builtin_ffs(mask));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HAVE_INLINE_FFSL
|
||||||
|
|
||||||
|
static __inline __pure2 int
|
||||||
|
ffsl(long mask)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (__builtin_ffsl(mask));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HAVE_INLINE_FFSLL
|
||||||
|
|
||||||
|
static __inline __pure2 int
|
||||||
|
ffsll(long long mask)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (__builtin_ffsll(mask));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HAVE_INLINE_FLS
|
||||||
|
|
||||||
|
static __inline __pure2 int
|
||||||
|
fls(int mask)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (mask == 0 ? 0 :
|
||||||
|
8 * sizeof(mask) - __builtin_clz((u_int)mask));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HAVE_INLINE_FLSL
|
||||||
|
|
||||||
|
static __inline __pure2 int
|
||||||
|
flsl(long mask)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (mask == 0 ? 0 :
|
||||||
|
8 * sizeof(mask) - __builtin_clzl((u_long)mask));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HAVE_INLINE_FLSLL
|
||||||
|
|
||||||
|
static __inline __pure2 int
|
||||||
|
flsll(long long mask)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (mask == 0 ? 0 :
|
||||||
|
8 * sizeof(mask) - __builtin_clzll((unsigned long long)mask));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#else /* !_KERNEL */
|
#else /* !_KERNEL */
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ kern/subr_devmap.c standard
|
||||||
kern/subr_sfbuf.c standard
|
kern/subr_sfbuf.c standard
|
||||||
libkern/arm/aeabi_unwind.c standard
|
libkern/arm/aeabi_unwind.c standard
|
||||||
libkern/arm/divsi3.S standard
|
libkern/arm/divsi3.S standard
|
||||||
libkern/arm/ffs.S standard
|
libkern/arm/ffs.S optional !armv7 !armv6
|
||||||
libkern/arm/ldivmod.S standard
|
libkern/arm/ldivmod.S standard
|
||||||
libkern/arm/ldivmod_helper.c standard
|
libkern/arm/ldivmod_helper.c standard
|
||||||
libkern/arm/memclr.S standard
|
libkern/arm/memclr.S standard
|
||||||
|
|
@ -139,11 +139,11 @@ libkern/arm/muldi3.c standard
|
||||||
libkern/ashldi3.c standard
|
libkern/ashldi3.c standard
|
||||||
libkern/ashrdi3.c standard
|
libkern/ashrdi3.c standard
|
||||||
libkern/divdi3.c standard
|
libkern/divdi3.c standard
|
||||||
libkern/ffsl.c standard
|
libkern/ffsl.c optional !armv7 !armv6
|
||||||
libkern/ffsll.c standard
|
libkern/ffsll.c optional !armv7 !armv6
|
||||||
libkern/fls.c standard
|
libkern/fls.c optional !armv7 !armv6
|
||||||
libkern/flsl.c standard
|
libkern/flsl.c optional !armv7 !armv6
|
||||||
libkern/flsll.c standard
|
libkern/flsll.c optional !armv7 !armv6
|
||||||
libkern/lshrdi3.c standard
|
libkern/lshrdi3.c standard
|
||||||
libkern/memcmp.c standard
|
libkern/memcmp.c standard
|
||||||
libkern/moddi3.c standard
|
libkern/moddi3.c standard
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue