Files
qemu-qemu-1/target-info.c
Philippe Mathieu-Daudé 2dc8c9cf72 qemu/target_info: Add target_s390x() helper
Add a helper to distinct whether the binary is targetting
S390x or not.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-3-philmd@linaro.org>
2026-02-26 00:02:14 +01:00

96 lines
1.5 KiB
C

/*
* QEMU target info helpers
*
* Copyright (c) Linaro
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "qemu/osdep.h"
#include "qemu/target-info.h"
#include "qemu/target-info-qapi.h"
#include "qemu/target-info-impl.h"
#include "qapi/error.h"
const char *target_name(void)
{
return target_info()->target_name;
}
unsigned target_long_bits(void)
{
return target_info()->long_bits;
}
SysEmuTarget target_arch(void)
{
return target_info()->target_arch;
}
const char *target_cpu_type(void)
{
return target_info()->cpu_type;
}
const char *target_machine_typename(void)
{
return target_info()->machine_typename;
}
EndianMode target_endian_mode(void)
{
return target_info()->endianness;
}
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;
}
bool target_aarch64(void)
{
return target_arch() == SYS_EMU_TARGET_AARCH64;
}
bool target_base_ppc(void)
{
switch (target_arch()) {
case SYS_EMU_TARGET_PPC:
case SYS_EMU_TARGET_PPC64:
return true;
default:
return false;
}
}
bool target_ppc(void)
{
return target_arch() == SYS_EMU_TARGET_PPC;
}
bool target_ppc64(void)
{
return target_arch() == SYS_EMU_TARGET_PPC64;
}
bool target_s390x(void)
{
return target_arch() == SYS_EMU_TARGET_S390X;
}