From: Philippe Mathieu-Daudé Date: Tue, 13 May 2025 11:50:10 +0000 (+0100) Subject: qemu/target_info: Add target_base_arm() helper X-Git-Tag: v10.2.0-rc1~35^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43cc9efdc341c960587d361be37bc0c6abf29749;p=thirdparty%2Fqemu.git qemu/target_info: Add target_base_arm() helper Add a helper to check whether the target base architecture is ARM (either 32-bit or 64-bit). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Acked-by: Peter Maydell Message-Id: <20251021210144.58108-3-philmd@linaro.org> --- diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index e8fbdf19d5..6235962223 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -50,6 +50,13 @@ const char *target_cpu_type(void); */ bool target_big_endian(void); +/** + * target_base_arm: + * + * Returns whether the target architecture is ARM or Aarch64. + */ +bool target_base_arm(void); + /** * target_arm: * diff --git a/target-info.c b/target-info.c index e567cb4c40..24696ff411 100644 --- a/target-info.c +++ b/target-info.c @@ -53,6 +53,17 @@ bool target_big_endian(void) return target_endian_mode() == ENDIAN_MODE_BIG; } +bool target_base_arm(void) +{ + switch (target_arch()) { + case SYS_EMU_TARGET_ARM: + case SYS_EMU_TARGET_AARCH64: + return true; + default: + return false; + } +} + bool target_arm(void) { return target_arch() == SYS_EMU_TARGET_ARM;