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

Philippe Mathieu-Daudé posted 12 patches 2 months, 3 weeks ago
There is a newer version of this series
[PATCH 02/12] target/mips: Introduce mo_endian_env() helper
Posted by Philippe Mathieu-Daudé 2 months, 3 weeks ago
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 --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 |
-- 
2.45.2