[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/8] hw/core/cpu: Expose cpu_is_big_endian() method
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 8/8] hw/core/cpu: Expose cpu_is_big_endian() method |
Date: |
Fri, 4 Oct 2024 13:21:18 -0300 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@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 22ef7a44e86..2550bc98dee 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -608,6 +608,14 @@ extern __thread CPUState *current_cpu;
extern bool mttcg_enabled;
#define qemu_tcg_mttcg_enabled() (mttcg_enabled)
+/**
+ * cpu_is_big_endian:
+ * @cpu: The CPU whose state is to be inspected.
+ *
+ * Returns: %true if the CPU runs in big endianness, %false otherwise.
+ */
+bool cpu_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 aa5ea9761e4..277c4ee6720 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_is_big_endian(CPUState *cpu)
+{
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+
+ return cc->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
- [PATCH 1/8] exec/tswap: Massage target_needs_bswap() definition, (continued)
- [PATCH 3/8] target/arm: Implement CPUClass::is_big_endian, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH 4/8] target/microblaze: Implement CPUClass::is_big_endian, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH 5/8] target/mips: Declare mips_env_is_bigendian() in 'internal.h', Philippe Mathieu-Daudé, 2024/10/04
- [PATCH 6/8] target/mips: Implement CPUClass::is_big_endian, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH 7/8] target/ppc: Register CPUClass::is_big_endian, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH 8/8] hw/core/cpu: Expose cpu_is_big_endian() method,
Philippe Mathieu-Daudé <=