On 2/14/23 22:47, Marcin Nowakowski wrote:
@@ -4860,6 +4860,7 @@ static void gen_compute_branch(DisasContext
*ctx, uint32_t opc,
target_ulong btgt = -1;
int blink = 0;
int bcond_compute = 0;
+ int jal_mask = 0;
Better to limit the scope of the variable to the block below.
@@ -4917,6 +4918,11 @@ static void gen_compute_branch(DisasContext
*ctx, uint32_t opc,
break;
case OPC_J:
case OPC_JAL:
+ /* Jump to immediate */
+ jal_mask = ctx->hflags & MIPS_HFLAG_M16 ? 0xF8000000 :
0xF0000000;
+ btgt = ((ctx->base.pc_next + insn_bytes) & jal_mask) |
+ (uint32_t)offset;
Ideally we wouldn't have one huge helper function, and could pass down
the mask from the translator. But that's on-going cleanup.