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é <[email protected]>
---
target/mips/tcg/nanomips_translate.c.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/mips/tcg/nanomips_translate.c.inc
b/target/mips/tcg/nanomips_translate.c.inc
index 524972b24a98..3612c68561fd 100644
--- a/target/mips/tcg/nanomips_translate.c.inc
+++ b/target/mips/tcg/nanomips_translate.c.inc
@@ -3545,7 +3545,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))) {
@@ -4481,7 +4481,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))) {
--
2.55.0