[PATCH v2 09/16] target/mips: Introduce mo_endian() helper

Philippe Mathieu-Daudé posted 16 patches 1 month, 2 weeks ago
[PATCH v2 09/16] target/mips: Introduce mo_endian() helper
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
Introduce mo_endian() which returns the endian MemOp
corresponding to the vCPU DisasContext.

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>
---
 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 c55f90e741b..49ff6b8cd80 100644
--- a/target/mips/tcg/translate.h
+++ b/target/mips/tcg/translate.h
@@ -240,6 +240,11 @@ static inline bool disas_is_bigendian(DisasContext *ctx)
     return extract32(ctx->CP0_Config0, CP0C0_BE, 1);
 }
 
+static inline MemOp mo_endian(DisasContext *dc)
+{
+    return disas_is_bigendian(dc) ? MO_BE : MO_LE;
+}
+
 static inline MemOp mo_endian_rev(DisasContext *dc, bool reversed)
 {
     return disas_is_bigendian(dc) ^ reversed ? MO_BE : MO_LE;
-- 
2.45.2


Re: [PATCH v2 09/16] target/mips: Introduce mo_endian() helper
Posted by Richard Henderson 1 month, 1 week ago
On 10/10/24 14:50, 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>
> Reviewed-by: Jiaxun Yang<jiaxun.yang@flygoat.com>
> Tested-by: Jiaxun Yang<jiaxun.yang@flygoat.com>
> ---
>   target/mips/tcg/translate.h | 5 +++++
>   1 file changed, 5 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~