Skip to contentSkip to conversation

testsuite/init_module: Handle __NR_riscv_hwprobe in syscall wrapper

PATCH New Andreas Schwab 1 participant 1 message Jun 30, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testsuite/init_module: Handle __NR_riscv_hwprobe in syscall wrapper

The libcrypto library constructor calls the riscv_hwprobe syscall through the syscall wrapper. Forward it to the __riscv_hwprobe function.

---
 testsuite/init_module.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
testsuite/init_module.c +21 -0
index 8ff2699..3516c1d 100644
@@ -26,6 +26,9 @@
 #include <sys/syscall.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
+#ifdef __riscv
+#include <sys/hwprobe.h>
+#endif
 
 #include <shared/util.h>
 
@@ -370,6 +373,24 @@ TS_EXPORT long int syscall(long int __sysno, ...)
 		return nextlib_syscall(__NR_gettid);
 	}
 
+#ifdef __NR_riscv_hwprobe
+	if (__sysno == __NR_riscv_hwprobe) {
+		struct riscv_hwprobe *pairs;
+		size_t pair_count, cpusetsize;
+		unsigned long int *cpus;
+		unsigned int flags;
+
+		va_start (ap, __sysno);
+		pairs = va_arg (ap, struct riscv_hwprobe *);
+		pair_count = va_arg (ap, size_t);
+		cpusetsize = va_arg (ap, size_t);
+		cpus = va_arg (ap, unsigned long int *);
+		flags = va_arg (ap, unsigned int);
+
+		return __riscv_hwprobe (pairs, pair_count, cpusetsize, cpus, flags);
+	}
+#endif
+
 	/*
 	 * FIXME: no way to call the libc function due since this is a
 	 * variadic argument function and we don't have a vsyscall() variant
Signature · 7 lines
2.50.0


-- 
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."