[PATCH v6 2/3] RISC-V: add MACRO support for dl_hwcap
daichengrong@iscas.ac.cn
daichengrong@iscas.ac.cn
Fri Feb 14 08:51:29 GMT 2025
From: daichengrong <daichengrong@iscas.ac.cn>
Changes:
add MACRO support for dl_hwcap to check ISA
---
sysdeps/unix/sysv/linux/riscv/sys/hwprobe.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/sysdeps/unix/sysv/linux/riscv/sys/hwprobe.h b/sysdeps/unix/sysv/linux/riscv/sys/hwprobe.h
index bebad6cf70..250f019766 100644
--- a/sysdeps/unix/sysv/linux/riscv/sys/hwprobe.h
+++ b/sysdeps/unix/sysv/linux/riscv/sys/hwprobe.h
@@ -61,6 +61,26 @@ struct riscv_hwprobe {
#endif /* RISCV_HWPROBE_KEY_MVENDORID */
+#ifndef _UAPI_ASM_RISCV_HWCAP_H
+#define _UAPI_ASM_RISCV_HWCAP_H
+
+/*
+ * Linux saves the floating-point registers according to the ISA Linux is
+ * executing on, as opposed to the ISA the user program is compiled for. This
+ * is necessary for a handful of esoteric use cases: for example, userspace
+ * threading libraries must be able to examine the actual machine state in
+ * order to fully reconstruct the state of a thread.
+ */
+#define COMPAT_HWCAP_ISA_I (1 << ('I' - 'A'))
+#define COMPAT_HWCAP_ISA_M (1 << ('M' - 'A'))
+#define COMPAT_HWCAP_ISA_A (1 << ('A' - 'A'))
+#define COMPAT_HWCAP_ISA_F (1 << ('F' - 'A'))
+#define COMPAT_HWCAP_ISA_D (1 << ('D' - 'A'))
+#define COMPAT_HWCAP_ISA_C (1 << ('C' - 'A'))
+#define COMPAT_HWCAP_ISA_V (1 << ('V' - 'A'))
+
+#endif /* _UAPI_ASM_RISCV_HWCAP_H */
+
__BEGIN_DECLS
extern int __riscv_hwprobe (struct riscv_hwprobe *__pairs, size_t __pair_count,
--
2.25.1
More information about the Libc-alpha
mailing list