Message ID | 20230216051717.3911212-2-marcin.nowakowski@fungible.com |
---|---|
State | New |
Headers | show |
Series | target/mips: misc microMIPS fixes | expand |
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 624e6b7786..567ca11ccf 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -4917,6 +4917,13 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, break; case OPC_J: case OPC_JAL: + { + /* Jump to immediate */ + int jal_mask = ctx->hflags & MIPS_HFLAG_M16 ? 0xF8000000 : 0xF0000000; + btgt = ((ctx->base.pc_next + insn_bytes) & jal_mask) | + (uint32_t)offset; + break; + } case OPC_JALX: /* Jump to immediate */ btgt = ((ctx->base.pc_next + insn_bytes) & (int32_t)0xF0000000) |