[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/20] hw/core/cpu: Expose cpu_datapath_is_big_endian() method
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 16/20] hw/core/cpu: Expose cpu_datapath_is_big_endian() method |
Date: |
Wed, 4 Dec 2024 21:25:58 +0100 |
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é <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 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
- [PATCH 07/20] target/riscv: Implement CPUClass::datapath_is_big_endian, (continued)
- [PATCH 07/20] target/riscv: Implement CPUClass::datapath_is_big_endian, Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 08/20] target/sh4: Expose CPUSH4State::little_endian property, Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 10/20] target/microblaze: Implement CPUClass::datapath_is_big_endian, Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 09/20] target/sh4: Implement CPUClass::datapath_is_big_endian, Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 11/20] target/mips: Implement CPUClass::datapath_is_big_endian, Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 12/20] target/xtensa: Implement xtensa_isa_is_big_endian(), Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 13/20] target/xtensa: Implement CPUClass::datapath_is_big_endian, Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 14/20] target: Implement CPUClass::datapath_is_big_endian (little-endian), Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 15/20] target: Implement CPUClass::datapath_is_big_endian (big-endian), Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 16/20] hw/core/cpu: Expose cpu_datapath_is_big_endian() method,
Philippe Mathieu-Daudé <=
- [PATCH 17/20] disas: Use cpu_datapath_is_big_endian(), Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 18/20] hw/core/generic-loader: Use cpu_datapath_is_big_endian(), Philippe Mathieu-Daudé, 2024/12/04
- [RFC PATCH 19/20] hw/virtio: Use cpu_datapath_is_big_endian(), Philippe Mathieu-Daudé, 2024/12/04
- [PATCH 20/20] hw/core/cpu: Remove cpu_virtio_is_big_endian(), Philippe Mathieu-Daudé, 2024/12/04