Commit f876fae1ee for qemu.org

commit f876fae1ee7e2e37e72e122d78f5f0402e5493fa
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date:   Wed Nov 11 17:47:20 2026 +0100

    target/mips: Pass the nanoMIPS BREAK code to generate_exception_break()

    The nanoMIPS BREAK[32] and BREAK[16] decoders call
    generate_exception_end() and drop the break code, leaving a
    stale env->error_code for linux-user. Pass the encoded 'code'
    19 bits for BREAK[32], 3 bits for BREAK[16] (MD01247 rev 01.01,
    p.59).

    Complete 6f3533dd1b6a ("target/mips: Extract break code into
    env->error_code").

    Fixes: c02809830346 ("target/mips: Add emulation of some nanoMIPS 32-bit")
    Fixes: 8869ad02bfd9 ("target/mips: Add emulation of nanoMIPS 16-bit misc")
    Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-ID: <20261113161158.25811-16-philmd@oss.qualcomm.com>

diff --git a/target/mips/tcg/nanomips_translate.c.inc b/target/mips/tcg/nanomips_translate.c.inc
index dcee8df333..19cca9463d 100644
--- a/target/mips/tcg/nanomips_translate.c.inc
+++ b/target/mips/tcg/nanomips_translate.c.inc
@@ -3573,7 +3573,7 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
                 }
                 break;
             case NM_BREAK:
-                generate_exception_end(ctx, EXCP_BREAK);
+                generate_exception_break(ctx, extract32(ctx->opcode, 0, 19));
                 break;
             case NM_SDBBP:
                 if (is_uhi(ctx, extract32(ctx->opcode, 0, 19))) {
@@ -4508,7 +4508,7 @@ static int decode_isa_nanomips(CPUMIPSState *env, DisasContext *ctx)
                 }
                 break;
             case NM_BREAK16:
-                generate_exception_end(ctx, EXCP_BREAK);
+                generate_exception_break(ctx, extract32(ctx->opcode, 0, 3));
                 break;
             case NM_SDBBP16:
                 if (is_uhi(ctx, extract32(ctx->opcode, 0, 3))) {