[PATCH 06/14] target-info: Add target_riscv64()

Anton Johansson via posted 14 patches 1 day, 8 hours ago
[PATCH 06/14] target-info: Add target_riscv64()
Posted by Anton Johansson via 1 day, 8 hours ago
Adds a helper function to tell if the binary is targeting riscv64 or
not.

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 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
Re: [PATCH 06/14] target-info: Add target_riscv64()
Posted by Pierrick Bouvier 1 day, 7 hours ago
On 12/16/25 3:51 PM, Anton Johansson wrote:
> Adds a helper function to tell if the binary is targeting riscv64 or
> not.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   include/qemu/target-info.h | 7 +++++++
>   target-info.c              | 5 +++++
>   2 files changed, 12 insertions(+)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>