diff --git a/qemu/target-m68k/translate.c b/qemu/target-m68k/translate.c index 516a0077..20a88159 100644 --- a/qemu/target-m68k/translate.c +++ b/qemu/target-m68k/translate.c @@ -2066,6 +2066,39 @@ DISAS_INSN(eor) DEST_EA(env, insn, OS_LONG, dest, &addr); } +static void do_exg(TCGContext *tcg_ctx, TCGv reg1, TCGv reg2) +{ + TCGv temp = tcg_temp_new(tcg_ctx); + tcg_gen_mov_i32(tcg_ctx, temp, reg1); + tcg_gen_mov_i32(tcg_ctx, reg1, reg2); + tcg_gen_mov_i32(tcg_ctx, reg2, temp); + tcg_temp_free(tcg_ctx, temp); +} + +DISAS_INSN(exg_aa) +{ + TCGContext *tcg_ctx = s->uc->tcg_ctx; + + /* exchange Dx and Dy */ + do_exg(tcg_ctx, DREG(insn, 9), DREG(insn, 0)); +} + +DISAS_INSN(exg_dd) +{ + TCGContext *tcg_ctx = s->uc->tcg_ctx; + + /* exchange Ax and Ay */ + do_exg(tcg_ctx, AREG(insn, 9), AREG(insn, 0)); +} + +DISAS_INSN(exg_da) +{ + TCGContext *tcg_ctx = s->uc->tcg_ctx; + + /* exchange Dx and Ay */ + do_exg(tcg_ctx, DREG(insn, 9), AREG(insn, 0)); +} + DISAS_INSN(and) { TCGContext *tcg_ctx = s->uc->tcg_ctx; @@ -3231,6 +3264,9 @@ void register_m68k_insns (CPUM68KState *env) INSN(cmpa, b0c0, f0c0, M68000); INSN(eor, b180, f1c0, CF_ISA_A); BASE(and, c000, f000); + INSN(exg_dd, c140, f1f8, M68000); + INSN(exg_aa, c148, f1f8, M68000); + INSN(exg_da, c188, f1f8, M68000); BASE(mulw, c0c0, f0c0); BASE(addsub, d000, f000); INSN(addx, d180, f1f8, CF_ISA_A);