]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu/target_info: Add target_base_arm() helper
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 13 May 2025 11:50:10 +0000 (12:50 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 30 Oct 2025 13:48:26 +0000 (14:48 +0100)
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>

include/qemu/target-info.h
target-info.c

index e8fbdf19d5312c2b2bbdb188b2accb9d67517a56..62359622232313cac2fdf9f3c2e19e27872695bb 100644 (file)
@@ -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:
  *
index e567cb4c40aa4473cd8c18b7190de3bc0fe273b4..24696ff41116fc2b46ed04410f9305186dee8698 100644 (file)
@@ -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;