Add a helper to check whether the target base architecture is ARM (either 32-bit or 64-bit).
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Pierrick Bouvier <[email protected]> Acked-by: Peter Maydell <[email protected]> Message-Id: <[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 e8fbdf19d53..62359622232 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 e567cb4c40a..24696ff4111 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; -- 2.51.0
