Message ID | 20240930091101.40591-6-philmd@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | target/mips: Remove target-specific endianness knowledge | expand |
On 9/30/24 02:10, Philippe Mathieu-Daudé wrote: > 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 --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; > +} Based on patch 6, I think you'd better pass 'bool reversed' to this function. Then disas_is_bigendian(dc) ^ reversed ? MO_BE : MO_LE; r~
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
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(+)