On 03/21/2010 01:08 PM, Gleb Natapov wrote:
Decode CMPXCHG8B destination operand in decoding stage. Fixes regression
introduced by "If LOCK prefix is used dest arg should be memory" commit.
This commit relies on dst operand be decoded at the beginning of an
instruction emulation.

@@ -1719,15 +1719,12 @@ static inline int emulate_grp9(struct x86_emulate_ctxt 
*ctxt,
                c->regs[VCPU_REGS_RAX] = (u32) (old>>  0);
                c->regs[VCPU_REGS_RDX] = (u32) (old>>  32);
                ctxt->eflags&= ~EFLG_ZF;
-
        } else {
-               new = ((u64)c->regs[VCPU_REGS_RCX]<<  32) |
+               c->dst.val = ((u64)c->regs[VCPU_REGS_RCX]<<  32) |
                       (u32) c->regs[VCPU_REGS_RBX];

-               rc = ops->cmpxchg_emulated(c->modrm_ea,&old,&new, 8, 
ctxt->vcpu);
-               if (rc != X86EMUL_CONTINUE)
-                       return rc;
                ctxt->eflags |= EFLG_ZF;
+               c->lock_prefix = 1;

Why is this bit needed? cmpxchg64b without lock is valid and racy, but the guest may know it is safe.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to