Message ID | 1548242160-16039-8-git-send-email-aleksandar.markovic@rt-rk.com |
---|---|
State | New |
Headers | show |
Series | target/mips: Misc fixes | expand |
> From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com> > Sent: Wednesday, January 23, 2019 12:15 PM > To: qemu-devel@nongnu.org > Cc: aurelien@aurel32.net; Aleksandar Markovic; Aleksandar Rikalo > Subject: [PATCH v2 7/9] target/mips: nanoMIPS: Fix branch handling > > From: Stefan Markovic <smarkovic@wavecomp.com> > > Fix nanoMIPS branch handling. > > Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com> > Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> > --- This should be tested well. Still: Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com> > target/mips/translate.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/target/mips/translate.c b/target/mips/translate.c > index aaf7dff..e9b5d1d 100644 > --- a/target/mips/translate.c > +++ b/target/mips/translate.c > @@ -19758,6 +19758,10 @@ static void gen_compute_imm_branch(DisasContext *ctx, uint32_t opc, > goto out; > } > > + /* branch completion */ > + clear_branch_hflags(ctx); > + ctx->base.is_jmp = DISAS_NORETURN; > + > if (bcond_compute == 0) { > /* Uncoditional compact branch */ > gen_goto_tb(ctx, 0, ctx->btarget); > @@ -19798,6 +19802,10 @@ static void gen_compute_nanomips_pbalrsc_branch(DisasContext *ctx, int rs, > tcg_gen_movi_tl(t1, ctx->base.pc_next + 4); > gen_op_addr_add(ctx, btarget, t1, t0); > > + /* branch completion */ > + clear_branch_hflags(ctx); > + ctx->base.is_jmp = DISAS_NORETURN; > + > /* unconditional branch to register */ > tcg_gen_mov_tl(cpu_PC, btarget); > tcg_gen_lookup_and_goto_ptr(); > @@ -19936,6 +19944,10 @@ static void gen_compute_compact_branch_nm(DisasContext *ctx, uint32_t opc, > goto out; > } > > + /* branch completion */ > + clear_branch_hflags(ctx); > + ctx->base.is_jmp = DISAS_NORETURN; > + > /* Generating branch here as compact branches don't have delay slot */ > gen_goto_tb(ctx, 1, ctx->btarget); > gen_set_label(fs); > -- > 2.7.4
diff --git a/target/mips/translate.c b/target/mips/translate.c index aaf7dff..e9b5d1d 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -19758,6 +19758,10 @@ static void gen_compute_imm_branch(DisasContext *ctx, uint32_t opc, goto out; } + /* branch completion */ + clear_branch_hflags(ctx); + ctx->base.is_jmp = DISAS_NORETURN; + if (bcond_compute == 0) { /* Uncoditional compact branch */ gen_goto_tb(ctx, 0, ctx->btarget); @@ -19798,6 +19802,10 @@ static void gen_compute_nanomips_pbalrsc_branch(DisasContext *ctx, int rs, tcg_gen_movi_tl(t1, ctx->base.pc_next + 4); gen_op_addr_add(ctx, btarget, t1, t0); + /* branch completion */ + clear_branch_hflags(ctx); + ctx->base.is_jmp = DISAS_NORETURN; + /* unconditional branch to register */ tcg_gen_mov_tl(cpu_PC, btarget); tcg_gen_lookup_and_goto_ptr(); @@ -19936,6 +19944,10 @@ static void gen_compute_compact_branch_nm(DisasContext *ctx, uint32_t opc, goto out; } + /* branch completion */ + clear_branch_hflags(ctx); + ctx->base.is_jmp = DISAS_NORETURN; + /* Generating branch here as compact branches don't have delay slot */ gen_goto_tb(ctx, 1, ctx->btarget); gen_set_label(fs);