From b796f934ff20bbd55c476f33c6e34ad301de8fec Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 28 Feb 2018 00:45:10 -0500 Subject: [PATCH] target-m68k: add dbcc Backports commit beff27ab3a60d8abab4a166670ca79b3c0970005 from qemu --- qemu/target-m68k/translate.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/qemu/target-m68k/translate.c b/qemu/target-m68k/translate.c index ac4df468..1f1a1436 100644 --- a/qemu/target-m68k/translate.c +++ b/qemu/target-m68k/translate.c @@ -1107,6 +1107,31 @@ DISAS_INSN(scc) tcg_temp_free(tcg_ctx, tmp); } +DISAS_INSN(dbcc) +{ + TCGContext *tcg_ctx = s->uc->tcg_ctx; + TCGLabel *l1; + TCGv reg; + TCGv tmp; + int16_t offset; + uint32_t base; + + reg = DREG(insn, 0); + base = s->pc; + offset = (int16_t)read_im16(env, s); + l1 = gen_new_label(tcg_ctx); + gen_jmpcc(s, (insn >> 8) & 0xf, l1); + + tmp = tcg_temp_new(tcg_ctx); + tcg_gen_ext16s_i32(tcg_ctx, tmp, reg); + tcg_gen_addi_i32(tcg_ctx, tmp, tmp, -1); + gen_partset_reg(s, OS_WORD, reg, tmp); + tcg_gen_brcondi_i32(tcg_ctx, TCG_COND_EQ, tmp, -1, l1); + gen_jmp_tb(s, 1, base + offset); + gen_set_label(tcg_ctx, l1); + gen_jmp_tb(s, 0, s->pc); +} + DISAS_INSN(undef_mac) { gen_exception(s, s->pc - 2, EXCP_LINEA); @@ -3219,6 +3244,7 @@ void register_m68k_insns (CPUM68KState *env) INSN(addsubq, 5080, f0c0, M68000); INSN(scc, 50c0, f0f8, CF_ISA_A); /* Scc.B Dx */ INSN(scc, 50c0, f0c0, M68000); /* Scc.B */ + INSN(dbcc, 50c8, f0f8, M68000); INSN(addsubq, 5080, f1c0, CF_ISA_A); INSN(tpf, 51f8, fff8, CF_ISA_A);