diff mbox series

[PULL,26/33] target/mips: Introduce mo_endian() helper

Message ID 20241015154443.71763-27-philmd@linaro.org
State Accepted
Commit 96ccd8534f8b7d3198621f0aad4690108eb15ff1
Headers show
Series [PULL,01/33] qemu/bswap: Undefine CPU_CONVERT() once done | expand

Commit Message

Philippe Mathieu-Daudé Oct. 15, 2024, 3:44 p.m. UTC
Introduce mo_endian() which returns the endian MemOp
corresponding to the vCPU DisasContext.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20241010215015.44326-10-philmd@linaro.org>
---
 target/mips/tcg/translate.h | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h
index c55f90e741b..49ff6b8cd80 100644
--- a/target/mips/tcg/translate.h
+++ b/target/mips/tcg/translate.h
@@ -240,6 +240,11 @@  static inline bool disas_is_bigendian(DisasContext *ctx)
     return extract32(ctx->CP0_Config0, CP0C0_BE, 1);
 }
 
+static inline MemOp mo_endian(DisasContext *dc)
+{
+    return disas_is_bigendian(dc) ? MO_BE : MO_LE;
+}
+
 static inline MemOp mo_endian_rev(DisasContext *dc, bool reversed)
 {
     return disas_is_bigendian(dc) ^ reversed ? MO_BE : MO_LE;