diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-03-23 12:47:37 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-04-25 17:09:58 +0200 |
commit | 3d881164d4fb2b0f6791cf28d9725926b8ded0d6 (patch) | |
tree | 112f3a02f297a1821d8d0d228ebbec95a2e76652 /include | |
parent | 802c4daf331339085823f2fc81917967da4b4c12 (diff) | |
download | qemu-3d881164d4fb2b0f6791cf28d9725926b8ded0d6.zip qemu-3d881164d4fb2b0f6791cf28d9725926b8ded0d6.tar.gz qemu-3d881164d4fb2b0f6791cf28d9725926b8ded0d6.tar.bz2 |
qemu: Convert target_name() to TargetInfo API
Have target_name() be a target-agnostic method, dispatching
to a per-target TargetInfo singleton structure.
By default a stub singleton is used. No logical change
expected.
Inspired-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250424222112.36194-3-philmd@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/core/cpu.h | 2 | ||||
-rw-r--r-- | include/qemu/target-info-impl.h | 26 | ||||
-rw-r--r-- | include/qemu/target-info.h | 7 |
3 files changed, 33 insertions, 2 deletions
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 2a02d4f..12b2ff1 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1121,8 +1121,6 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp); void cpu_exec_unrealizefn(CPUState *cpu); void cpu_exec_reset_hold(CPUState *cpu); -const char *target_name(void); - #ifdef COMPILING_PER_TARGET extern const VMStateDescription vmstate_cpu_common; diff --git a/include/qemu/target-info-impl.h b/include/qemu/target-info-impl.h new file mode 100644 index 0000000..d30805f --- /dev/null +++ b/include/qemu/target-info-impl.h @@ -0,0 +1,26 @@ +/* + * QEMU TargetInfo structure definition + * + * Copyright (c) Linaro + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QEMU_TARGET_INFO_IMPL_H +#define QEMU_TARGET_INFO_IMPL_H + +#include "qemu/target-info.h" + +typedef struct TargetInfo { + /* runtime equivalent of TARGET_NAME definition */ + const char *target_name; +} TargetInfo; + +/** + * target_info: + * + * Returns: The TargetInfo structure definition for this target binary. + */ +const TargetInfo *target_info(void); + +#endif diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index b4cc488..58d4136 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -10,6 +10,13 @@ #define QEMU_TARGET_INFO_H /** + * target_name: + * + * Returns: Canonical target name (i.e. "i386"). + */ +const char *target_name(void); + +/** * target_cpu_type: * * Returns: target CPU base QOM type name (i.e. TYPE_X86_CPU). |