target-m68k: fix gen_flush_flags()

gen_flush_flags() is setting unconditionally cc_op_synced to 1
and s->cc_op to CC_OP_FLAGS, whereas env->cc_op can be set
to something else by a previous tcg fragment.

We fix that by not setting cc_op_synced to 1
(except for gen_helper_flush_flags() that updates env->cc_op)

FIX: https://github.com/vivier/qemu-m68k/issues/19

Backports commit 695576db2daaf2bdc63e7f6d36038b61caed622a from qemu
This commit is contained in:
Laurent Vivier 2018-03-01 19:13:33 -05:00 committed by Lioncash
parent b3c3cf84a5
commit 1197d778cc
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -585,18 +585,19 @@ static void gen_flush_flags(DisasContext *s)
case CC_OP_DYNAMIC: case CC_OP_DYNAMIC:
gen_helper_flush_flags(tcg_ctx, tcg_ctx->cpu_env, tcg_ctx->QREG_CC_OP); gen_helper_flush_flags(tcg_ctx, tcg_ctx->cpu_env, tcg_ctx->QREG_CC_OP);
s->cc_op_synced = 1;
break; break;
default: default:
t0 = tcg_const_i32(tcg_ctx, s->cc_op); t0 = tcg_const_i32(tcg_ctx, s->cc_op);
gen_helper_flush_flags(tcg_ctx, tcg_ctx->cpu_env, t0); gen_helper_flush_flags(tcg_ctx, tcg_ctx->cpu_env, t0);
tcg_temp_free(tcg_ctx, t0); tcg_temp_free(tcg_ctx, t0);
s->cc_op_synced = 1;
break; break;
} }
/* Note that flush_flags also assigned to env->cc_op. */ /* Note that flush_flags also assigned to env->cc_op. */
s->cc_op = CC_OP_FLAGS; s->cc_op = CC_OP_FLAGS;
s->cc_op_synced = 1;
} }
static inline TCGv gen_extend(DisasContext *s, TCGv val, int opsize, int sign) static inline TCGv gen_extend(DisasContext *s, TCGv val, int opsize, int sign)