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é <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20251021210144.58108-3-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé
2025-05-13 12:50:10 +01:00
parent 4306fc0f83
commit 43cc9efdc3
2 changed files with 18 additions and 0 deletions

View File

@@ -50,6 +50,13 @@ const char *target_cpu_type(void);
*/ */
bool target_big_endian(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: * target_arm:
* *

View File

@@ -53,6 +53,17 @@ bool target_big_endian(void)
return target_endian_mode() == ENDIAN_MODE_BIG; 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) bool target_arm(void)
{ {
return target_arch() == SYS_EMU_TARGET_ARM; return target_arch() == SYS_EMU_TARGET_ARM;