All target implement their CPUClass::datapath_is_big_endian() helper, we can expose the generic cpu_datapath_is_big_endian() method.
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- include/hw/core/cpu.h | 8 ++++++++ hw/core/cpu-common.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 91c6581f814..5c75fe3a842 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -611,6 +611,14 @@ extern __thread CPUState *current_cpu; extern bool mttcg_enabled; #define qemu_tcg_mttcg_enabled() (mttcg_enabled) +/** + * cpu_datapath_is_big_endian: + * @cpu: The CPU whose state is to be inspected. + * + * Returns: %true if the CPU access data in big endian order, %false otherwise. + */ +bool cpu_datapath_is_big_endian(CPUState *cpu); + /** * cpu_paging_enabled: * @cpu: The CPU whose state is to be inspected. diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 09c79035949..92c0c4c6125 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -66,6 +66,13 @@ CPUState *cpu_create(const char *typename) return cpu; } +bool cpu_datapath_is_big_endian(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + return cc->datapath_is_big_endian(cpu); +} + /* Resetting the IRQ comes from across the code base so we take the * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) -- 2.45.2