target/mips: Introduce mo_endian_env() helper

Introduce mo_endian_env() which returns the endian
MemOp corresponding to the vCPU env.

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-4-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2024-09-26 19:06:02 +02:00
parent e99072b6ec
commit 3e10be7579
1 changed files with 5 additions and 0 deletions

View File

@ -230,6 +230,11 @@ static inline bool mips_env_is_bigendian(CPUMIPSState *env)
return extract32(env->CP0_Config0, CP0C0_BE, 1);
}
static inline MemOp mo_endian_env(CPUMIPSState *env)
{
return mips_env_is_bigendian(env) ? MO_BE : MO_LE;
}
static inline void restore_pamask(CPUMIPSState *env)
{
if (env->hflags & MIPS_HFLAG_ELPA) {