diff mbox series

[RFC,v4,15/19] qemu/target_info: Add target_aarch64() helper

Message ID 20250422145502.70770-16-philmd@linaro.org
State New
Headers show
Series single-binary: Make hw/arm/ common | expand

Commit Message

Philippe Mathieu-Daudé April 22, 2025, 2:54 p.m. UTC
Add a helper to distinct the binary is targetting
Aarch64 or not.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/qemu/target-info.h | 7 +++++++
 target-info.c              | 5 +++++
 2 files changed, 12 insertions(+)

Comments

Richard Henderson April 22, 2025, 5:46 p.m. UTC | #1
On 4/22/25 07:54, Philippe Mathieu-Daudé wrote:
> Add a helper to distinct the binary is targetting
> Aarch64 or not.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   include/qemu/target-info.h | 7 +++++++
>   target-info.c              | 5 +++++
>   2 files changed, 12 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Pierrick Bouvier April 22, 2025, 6:21 p.m. UTC | #2
On 4/22/25 07:54, Philippe Mathieu-Daudé wrote:
> Add a helper to distinct the binary is targetting
> Aarch64 or not.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/qemu/target-info.h | 7 +++++++
>   target-info.c              | 5 +++++
>   2 files changed, 12 insertions(+)
> 
> diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
> index 0224b35b166..395c009baf2 100644
> --- a/include/qemu/target-info.h
> +++ b/include/qemu/target-info.h
> @@ -24,4 +24,11 @@ const char *target_name(void);
>    */
>   const char *target_machine_typename(void);
>   
> +/**
> + * target_aarch64:
> + *
> + * Returns whether the target architecture is Aarch64.
> + */
> +bool target_aarch64(void);
> +
>   #endif
> diff --git a/target-info.c b/target-info.c
> index 0042769e3a2..7f1758ae34f 100644
> --- a/target-info.c
> +++ b/target-info.c
> @@ -19,3 +19,8 @@ const char *target_machine_typename(void)
>   {
>       return target_info()->machine_typename;
>   }
> +
> +bool target_aarch64(void)
> +{
> +    return target_info()->target_arch == SYS_EMU_TARGET_AARCH64;
> +}

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff mbox series

Patch

diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
index 0224b35b166..395c009baf2 100644
--- a/include/qemu/target-info.h
+++ b/include/qemu/target-info.h
@@ -24,4 +24,11 @@  const char *target_name(void);
  */
 const char *target_machine_typename(void);
 
+/**
+ * target_aarch64:
+ *
+ * Returns whether the target architecture is Aarch64.
+ */
+bool target_aarch64(void);
+
 #endif
diff --git a/target-info.c b/target-info.c
index 0042769e3a2..7f1758ae34f 100644
--- a/target-info.c
+++ b/target-info.c
@@ -19,3 +19,8 @@  const char *target_machine_typename(void)
 {
     return target_info()->machine_typename;
 }
+
+bool target_aarch64(void)
+{
+    return target_info()->target_arch == SYS_EMU_TARGET_AARCH64;
+}