On 05/08/21 13:24, Paolo Bonzini wrote:
On 05/08/21 11:51, Stevie Lavern wrote:

Shouldn't it be:
eflags = cpu_cc_compute_all(env, CC_OP) | (env->df & DF_MASK);
as eflags is entirely reevaluated by "cpu_cc_compute_all" ?

No, both are wrong.  env->eflags contains flags other than the arithmetic flags (OF/SF/ZF/AF/PF/CF) and those have to be preserved.

The right code is in helper_read_eflags.  You can move it into cpu_compute_eflags, and make helper_read_eflags use it.

Ah, actually the two are really the same, the TF/VM bits do not apply to cpu_compute_eflags so it's correct.

What seems wrong is migration of the EFLAGS register. There should be code in cpu_pre_save and cpu_post_load to special-case it and setup CC_DST/CC_OP as done in cpu_load_eflags.

Also, cpu_load_eflags should assert that update_mask does not include any of the arithmetic flags.

Paolo

Reply via email to