diff mbox series

[05/12] target/mips: Introduce mo_endian() helper

Message ID 20240930091101.40591-6-philmd@linaro.org
State New
Headers show
Series target/mips: Remove target-specific endianness knowledge | expand

Commit Message

Philippe Mathieu-Daudé Sept. 30, 2024, 9:10 a.m. UTC
Introduce mo_endian() which returns the endian MemOp
corresponding to the vCPU DisasContext.

Signed-off-by: Philippe Mathieu-Daudé <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 2b6646b339..54955437ef 100644
--- a/target/mips/tcg/translate.h
+++ b/target/mips/tcg/translate.h
@@ -240,4 +240,9 @@  static inline bool cpu_is_bigendian(DisasContext *ctx)
     return extract32(ctx->CP0_Config0, CP0C0_BE, 1);
 }
 
+static inline MemOp mo_endian(DisasContext *dc)
+{
+    return cpu_is_bigendian(dc) ? MO_BE : MO_LE;
+}
+
 #endif