From c090c97d925ce751d8834d5c5a404952598f67c0 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 23 Nov 2016 13:57:56 +0100 Subject: [PATCH 1/3] target-m68k: fix EXG instruction opcodes of "EXG Ax,Ay" and "EXG Dx,Dy" have been swapped Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- target-m68k/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 9ad974f86a..8e522db9f3 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -2198,13 +2198,13 @@ static void do_exg(TCGv reg1, TCGv reg2) tcg_temp_free(temp); } -DISAS_INSN(exg_aa) +DISAS_INSN(exg_dd) { /* exchange Dx and Dy */ do_exg(DREG(insn, 9), DREG(insn, 0)); } -DISAS_INSN(exg_dd) +DISAS_INSN(exg_aa) { /* exchange Ax and Ay */ do_exg(AREG(insn, 9), AREG(insn, 0)); From 5436c29d78957a6825a93f0eb79dfab388641017 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 23 Nov 2016 21:45:56 +0100 Subject: [PATCH 2/3] target-m68k: Fix cmpa operand size "The size of the operation can be specified as word or long. Word length source operands are sign-extended to 32 bits for comparison." So comparison is always done using OS_LONG. Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- target-m68k/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 8e522db9f3..d2d68163b3 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -2170,7 +2170,7 @@ DISAS_INSN(cmpa) } SRC_EA(env, src, opsize, 1, NULL); reg = AREG(insn, 9); - gen_update_cc_cmp(s, reg, src, opsize); + gen_update_cc_cmp(s, reg, src, OS_LONG); } DISAS_INSN(eor) From 4a18cd44f3c905d443c26e26bb9b09932606d1a3 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 24 Nov 2016 09:31:32 +0100 Subject: [PATCH 3/3] target-m68k: fix muluw/mulsw "The multiplier and multiplicand are both word operands, and the result is a long-word operand." So compute flags on a long-word result, not on a word result. Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- target-m68k/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index d2d68163b3..d6ed883882 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -1186,7 +1186,7 @@ DISAS_INSN(mulw) SRC_EA(env, src, OS_WORD, sign, NULL); tcg_gen_mul_i32(tmp, tmp, src); tcg_gen_mov_i32(reg, tmp); - gen_logic_cc(s, tmp, OS_WORD); + gen_logic_cc(s, tmp, OS_LONG); } DISAS_INSN(divw)