- Implement NEON runtime detection on FreeBSD 11.* armv6 --- src/arm/cpu.c.orig 2019-05-11 15:23:10 UTC +++ src/arm/cpu.c @@ -75,6 +75,36 @@ static unsigned parse_proc_cpuinfo(const char *flag) { } #endif +#if defined(__FreeBSD__) && __FreeBSD__ < 12 +#include +#include +#include +#include +#include + +#define HAVE_GETAUXVAL +#define NEON_HWCAP HWCAP_NEON +static unsigned long getauxval(unsigned long type) { + Elf_Auxinfo auxv[AT_COUNT]; + size_t len = sizeof(auxv); + int mib[] = { + CTL_KERN, + KERN_PROC, + KERN_PROC_AUXV, + getpid(), + }; + + if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) != -1) { + for (size_t i = 0; i < nitems(auxv); i++) + if ((unsigned long)auxv[i].a_type == type) + return auxv[i].a_un.a_val; + + errno = ENOENT; + } + return 0; +} +#endif + COLD unsigned dav1d_get_cpu_flags_arm(void) { unsigned flags = 0; #if ARCH_AARCH64