aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia/aom/files/patch-aom__ports_riscv__cpudetect.c
blob: 620b4948ebf79e7b380a0413536b83f6826b97bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- Implement runtime detection on FreeBSD

--- aom_ports/riscv_cpudetect.c.orig	2025-09-05 22:10:37 UTC
+++ aom_ports/riscv_cpudetect.c
@@ -23,6 +23,20 @@
 
 #define HWCAP_RVV (1 << ('v' - 'a'))
 
+#if defined(__FreeBSD__)
+static unsigned long getauxval(unsigned long type)
+{
+    /* Only AT_HWCAP* return unsigned long */
+    if (type != AT_HWCAP && type != AT_HWCAP2) {
+        return 0;
+    }
+
+    unsigned long ret = 0;
+    elf_aux_info(type, &ret, sizeof(ret));
+    return ret;
+}
+#endif
+
 int riscv_simd_caps(void) {
   int flags = 0;
 #if HAVE_RVV