Adds a helper function to tell if the binary is targeting riscv64 or
not.

Signed-off-by: Anton Johansson <[email protected]>
---
 include/qemu/target-info.h | 7 +++++++
 target-info.c              | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
index 6235962223..a4853ad4bb 100644
--- a/include/qemu/target-info.h
+++ b/include/qemu/target-info.h
@@ -71,4 +71,11 @@ bool target_arm(void);
  */
 bool target_aarch64(void);
 
+/**
+ * target_riscv64:
+ *
+ * Returns whether the target architecture is riscv64
+ */
+bool target_riscv64(void);
+
 #endif
diff --git a/target-info.c b/target-info.c
index 24696ff411..6cc78e25c8 100644
--- a/target-info.c
+++ b/target-info.c
@@ -73,3 +73,8 @@ bool target_aarch64(void)
 {
     return target_arch() == SYS_EMU_TARGET_AARCH64;
 }
+
+bool target_riscv64(void)
+{
+    return target_arch() == SYS_EMU_TARGET_RISCV64;
+}

-- 
2.51.0


Reply via email to