[RFC PATCH 11/11] target/ppc: update DisasContext default_tcg_memop_mask value

Mark Cave-Ayland posted 11 patches 5 months ago
Maintainers: Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>
[RFC PATCH 11/11] target/ppc: update DisasContext default_tcg_memop_mask value
Posted by Mark Cave-Ayland 5 months ago
If address swizzling is enabled for little endian accesses, don't use little endian
memory ordering. This is because the conversion is performed by swizzling the
physical address lines as opposed to reversing the memory storage order.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 target/ppc/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index e8ae96cd46..4a0be4d70c 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -6664,7 +6664,8 @@ static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
     ctx->access_type = -1;
     ctx->need_access_type = !mmu_is_64bit(env->mmu_model);
     ctx->le_mode = (hflags >> HFLAGS_LE) & 1;
-    ctx->default_tcg_memop_mask = ctx->le_mode ? MO_LE : MO_BE;
+    ctx->default_tcg_memop_mask = (!need_addrswizzle_le(ctx) &&
+                                   ctx->le_mode) ? MO_LE : MO_BE;
     ctx->flags = env->flags;
 #if defined(TARGET_PPC64)
     ctx->excp_model = env->excp_model;
-- 
2.39.5