Commit 4c53ae3540 for qemu.org

commit 4c53ae3540ad258d4c665357dbacead79b101b55
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date:   Wed Nov 11 17:46:45 2026 +0100

    target/mips: Fix microMIPS CACHE offset used for ITC tag access

    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é <philmd@oss.qualcomm.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-ID: <20261113161158.25811-9-philmd@oss.qualcomm.com>

diff --git a/target/mips/tcg/micromips_translate.c.inc b/target/mips/tcg/micromips_translate.c.inc
index 4ad2b69961..21374e3ec6 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: