On 06/14/2017 01:39 PM, Laurent Vivier wrote:
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<laur...@vivier.eu>
---
  target/m68k/translate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <r...@twiddle.net>


r~

Reply via email to