diff mbox series

[02/12] target/mips: Introduce mo_endian_env() helper

Message ID 20240930091101.40591-3-philmd@linaro.org (mailing list archive)
State New, archived
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_env() which returns the endian
MemOp corresponding to the vCPU env.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/mips/internal.h | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/target/mips/internal.h b/target/mips/internal.h
index 1ce2bbf62d..5fe1af22ff 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -293,6 +293,11 @@  static inline bool cpu_is_bigendian_env(CPUMIPSState *env)
     return extract32(env->CP0_Config0, CP0C0_BE, 1);
 }
 
+static inline MemOp mo_endian_env(CPUMIPSState *env)
+{
+    return cpu_is_bigendian_env(env) ? MO_BE : MO_LE;
+}
+
 static inline void compute_hflags(CPUMIPSState *env)
 {
     env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 |