qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target-i386: set CC_OP to CC_OP_EFLAGS in cpu_l


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] target-i386: set CC_OP to CC_OP_EFLAGS in cpu_load_eflags
Date: Fri, 16 May 2014 11:34:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]