CACHE is encoded in POOL32B with a 9-bit signed offset in bits 8:0
(MD00582 rev 6.04, p. 144).  The decoder passed the generic 'imm'
(the low 16 bits of the opcode), which also holds the minor opcode
and reserved bits 15:9, so the ITC tag access used a wrong effective
address.  Extract the 9-bit offset, as done for CACHEE.

Fixes: 0d74a222c27e ("target-mips: make ITC Configuration Tags accessible")
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 target/mips/tcg/micromips_translate.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/mips/tcg/micromips_translate.c.inc 
b/target/mips/tcg/micromips_translate.c.inc
index 4ad2b699615e..21374e3ec60f 100644
--- a/target/mips/tcg/micromips_translate.c.inc
+++ b/target/mips/tcg/micromips_translate.c.inc
@@ -1820,7 +1820,7 @@ static void decode_micromips32_opc(CPUMIPSState *env, 
DisasContext *ctx)
         case CACHE:
             check_cp0_enabled(ctx);
             if (ctx->hflags & MIPS_HFLAG_ITC_CACHE) {
-                gen_cache_operation(ctx, rt, rs, imm);
+                gen_cache_operation(ctx, rt, rs, SIMM(ctx->opcode, 0, 9));
             }
             break;
         case LWC2:
-- 
2.55.0


Reply via email to