Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/multimedia/aom/files/patch-aom__ports_aarch64__cpudetect.c
18157 views
1
- Implement runtime detection on FreeBSD
2
3
--- aom_ports/aarch64_cpudetect.c.orig 2023-11-30 23:18:12 UTC
4
+++ aom_ports/aarch64_cpudetect.c
5
@@ -95,9 +95,23 @@ static int arm_get_cpu_caps(void) {
6
return flags;
7
}
8
9
-#elif defined(__linux__) // end defined(AOM_USE_ANDROID_CPU_FEATURES)
10
+#elif defined(__linux__) || defined(__FreeBSD__) // end defined(AOM_USE_ANDROID_CPU_FEATURES)
11
12
#include <sys/auxv.h>
13
+
14
+#if defined(__FreeBSD__)
15
+static unsigned long getauxval(unsigned long type)
16
+{
17
+ /* Only AT_HWCAP* return unsigned long */
18
+ if (type != AT_HWCAP && type != AT_HWCAP2) {
19
+ return 0;
20
+ }
21
+
22
+ unsigned long ret = 0;
23
+ elf_aux_info(type, &ret, sizeof(ret));
24
+ return ret;
25
+}
26
+#endif
27
28
// Define hwcap values ourselves: building with an old auxv header where these
29
// hwcap values are not defined should not prevent features from being enabled.
30
31