Il 15/05/2014 19:30, Richard Henderson ha scritto:
On 05/15/2014 10:04 AM, Paolo Bonzini wrote:
There is no reason to keep that out of the function. The comment refers
to the disassembler's cc_op state rather than the CPUState field.
Yes, but...
-/* NOTE: CC_OP must be modified manually to CC_OP_EFLAGS */
+/* NOTE: set CC_OP to CC_OP_EFLAGS after calling a helper that uses this! */
static inline void cpu_load_eflags(CPUX86State *env, int eflags,
int update_mask)
{
CC_SRC = eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
+ CC_OP = CC_OP_EFLAGS;
env->df = 1 - (2 * ((eflags >> 10) & 1));
... we'd do well to reflect that in the comment here, rather than
in the commit message. Because by itself it looks like the comment
is out of date.
That's what I tried to do, but my wording was awful.
/* NOTE: the translator must set DisasContext.cc_op to CC_OP_EFLAGS
after generating a call to a helper that uses this. */
Much better.
--- a/target-i386/svm_helper.c
+++ b/target-i386/svm_helper.c
@@ -260,7 +260,6 @@ void helper_vmrun(CPUX86State *env, int aflag, int
next_eip_addend)
env->vm_vmcb + offsetof(struct vmcb,
save.rflags)),
~(CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C | DF_MASK));
- CC_OP = CC_OP_EFLAGS;
svm_load_seg_cache(env, env->vm_vmcb + offsetof(struct vmcb, save.es),
R_ES);
--
I see two sets of CC_OP in svm_helper.c. Missed one?
Yes.
Paolo