qemu-patch-raspberry4/target/m68k
Laurent Vivier 043b936ef6 target/m68k: fix V flag for CC_OP_SUBx
V flag for subtraction is:

   v = (res ^ src1) & (src1 ^ src2)

(see COMPUTE_CCR() in target/m68k/helper.c)

But gen_flush_flags() uses:

   v = (res ^ src2) & (src1 ^ src2)

The problem has been found with the following program:

        .global _start
_start:
        move.l  #-2147483648,%d0
        subq.l  #1,%d0
        jvc     1f
        move.l #1,%d1
        move.l #1,%d0
        trap #0
1:
        move.l #0,%d1
        move.l #1,%d0
        trap #0

It works fine (exit(1)) on real hardware, and with "-singlestep".

"-singlestep" uses gen_helper_flush_flags(), whereas
without "-singlestep", V flag is computed directly in
gen_flush_flags().

This patch updates gen_flush_flags() to have the same result
as with gen_helper_flush_flags().

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <20170614203905.19657-1-laurent@vivier.eu>
2017-06-15 08:50:30 +02:00
..
cpu-qom.h Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
cpu.c target/m68k: implement rtd 2017-06-07 11:18:30 +02:00
cpu.h target/m68k: implement rtd 2017-06-07 11:18:30 +02:00
gdbstub.c Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
helper.c target-m68k: Inline shifts 2016-12-27 18:28:40 +01:00
helper.h target-m68k: Implement bfffo 2017-01-14 10:06:21 +01:00
m68k-semi.c Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
Makefile.objs Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
op_helper.c target-m68k: Implement bfffo 2017-01-14 10:06:21 +01:00
qregs.def target-m68k: add 680x0 divu/divs variants 2016-12-27 18:16:42 +01:00
translate.c target/m68k: fix V flag for CC_OP_SUBx 2017-06-15 08:50:30 +02:00