[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 13/17] target/microblaze: Introduce mo_endian() helper
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 13/17] target/microblaze: Introduce mo_endian() helper |
Date: |
Fri, 8 Nov 2024 15:43:13 +0000 |
mo_endian() returns the target endianness, currently static.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/microblaze/translate.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index 86f3c19618..0b466db694 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -707,12 +707,17 @@ static void record_unaligned_ess(DisasContext *dc, int rd,
}
#endif
+static inline MemOp mo_endian(DisasContext *dc)
+{
+ return MO_TE;
+}
+
static bool do_load(DisasContext *dc, int rd, TCGv addr, MemOp mop,
int mem_index, bool rev)
{
MemOp size = mop & MO_SIZE;
- mop |= MO_TE;
+ mop |= mo_endian(dc);
/*
* When doing reverse accesses we need to do two things.
@@ -847,7 +852,8 @@ static bool trans_lwx(DisasContext *dc, arg_typea *arg)
/* lwx does not throw unaligned access errors, so force alignment */
tcg_gen_andi_tl(addr, addr, ~3);
- tcg_gen_qemu_ld_i32(cpu_res_val, addr, dc->mem_index, MO_TE | MO_UL);
+ tcg_gen_qemu_ld_i32(cpu_res_val, addr, dc->mem_index,
+ mo_endian(dc) | MO_UL);
tcg_gen_mov_tl(cpu_res_addr, addr);
if (arg->rd) {
@@ -864,7 +870,7 @@ static bool do_store(DisasContext *dc, int rd, TCGv addr,
MemOp mop,
{
MemOp size = mop & MO_SIZE;
- mop |= MO_TE;
+ mop |= mo_endian(dc);
/*
* When doing reverse accesses we need to do two things.
@@ -1018,7 +1024,7 @@ static bool trans_swx(DisasContext *dc, arg_typea *arg)
tcg_gen_atomic_cmpxchg_i32(tval, cpu_res_addr, cpu_res_val,
reg_for_write(dc, arg->rd),
- dc->mem_index, MO_TE | MO_UL);
+ dc->mem_index, mo_endian(dc) | MO_UL);
tcg_gen_brcond_i32(TCG_COND_NE, cpu_res_val, tval, swx_fail);
--
2.45.2
- Re: [RFC PATCH v3 04/17] hw/net/xilinx_ethlite: Simplify by having configurable endianness, (continued)
- [PATCH v3 06/17] hw/timer/xilinx_timer: Make device endianness configurable, Philippe Mathieu-Daudé, 2024/11/08
- [RFC PATCH v3 05/17] hw/timer/xilinx_timer: Allow down to 8-bit memory access, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 08/17] hw/ssi/xilinx_spi: Make device endianness configurable, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 07/17] hw/char/xilinx_uartlite: Make device endianness configurable, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 09/17] hw/ssi/xilinx_spips: Make device endianness configurable, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 10/17] hw/arm/xlnx-zynqmp: Use &error_abort for programming errors, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 11/17] target/microblaze: Explode MO_TExx -> MO_TE | MO_xx, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 12/17] target/microblaze: Set MO_TE once in do_load() / do_store(), Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 13/17] target/microblaze: Introduce mo_endian() helper,
Philippe Mathieu-Daudé <=
- [PATCH v3 14/17] target/microblaze: Consider endianness while translating code, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 16/17] tests/functional: Explicit endianness of microblaze assets, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 15/17] hw/microblaze: Support various endianness for s3adsp1800 machines, Philippe Mathieu-Daudé, 2024/11/08
- [PATCH v3 17/17] tests/functional: Add microblaze cross-endianness tests, Philippe Mathieu-Daudé, 2024/11/08