@samitouri / QOSamiQemu / commits / 9067113cdf

target-info: Add target_riscv64()

Adds a helper function to tell if the binary is targeting riscv64 or not. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Anton Johansson <anjo@rev.ng> Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20260520-hw-riscv-cpu-int-v3-7-d1123ea63d9c@rev.ng> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Anton Johansson committed May 7, 2025 at 12:46 UTC 9067113cdf0e4e0b4c34308692dcec483dfd9ef4
2 files changed +12
include/qemu/target-info.h
+7
@@ -99,4 +99,11 @@ bool target_ppc64(void);
99 */
100 bool target_s390x(void);
101
102 +/**
103 + * target_riscv64:
104 + *
105 + * Returns whether the target architecture is riscv64
106 + */
107 +bool target_riscv64(void);
108 +
109 #endif
target-info.c
+5
@@ -93,3 +93,8 @@ bool target_s390x(void)
93 {
94 return target_arch() == SYS_EMU_TARGET_S390X;
95 }
96 +
97 +bool target_riscv64(void)
98 +{
99 + return target_arch() == SYS_EMU_TARGET_RISCV64;
100 +}