Signed-off-by: Pierrick Bouvier <[email protected]>
---
include/qemu/target-info.h | 7 +++++++
target-info.c | 11 +++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
index 862097c6c63..b0f3b4cfb8b 100644
--- a/include/qemu/target-info.h
+++ b/include/qemu/target-info.h
@@ -112,6 +112,13 @@ bool target_ppc64(void);
*/
bool target_s390x(void);
+/**
+ * target_base_riscv:
+ *
+ * Returns whether the target architecture is RISC-V 32-bit or 64-bit.
+ */
+bool target_base_riscv(void);
+
/**
* target_riscv64:
*
diff --git a/target-info.c b/target-info.c
index 254530d8ea5..e827026bd23 100644
--- a/target-info.c
+++ b/target-info.c
@@ -104,6 +104,17 @@ bool target_s390x(void)
return target_arch() == SYS_EMU_TARGET_S390X;
}
+bool target_base_riscv(void)
+{
+ switch (target_arch()) {
+ case SYS_EMU_TARGET_RISCV32:
+ case SYS_EMU_TARGET_RISCV64:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool target_riscv64(void)
{
return target_arch() == SYS_EMU_TARGET_RISCV64;
--
2.47.3