From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: x86 emulator: add decoding of CMPXCHG8B dst operand.
Date: Sun, 21 Mar 2010 16:44:25 +0200 [thread overview]
Message-ID: <20100321144425.GG13522@redhat.com> (raw)
In-Reply-To: <4BA63014.9060304@redhat.com>
On Sun, Mar 21, 2010 at 04:41:24PM +0200, Avi Kivity wrote:
> 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.
>
Agree. Before this patch cmpxchg8b emulation always called
cmpxchg_emulated(), so to be extra careful I wanted to preserve old
behaviour. Resend the patch without this line?
--
Gleb.
next prev parent reply other threads:[~2010-03-21 14:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-21 11:08 [PATCH 1/2] KVM: x86 emulator: commit rflags as part of registers commit Gleb Natapov
2010-03-21 11:08 ` [PATCH 2/2] KVM: x86 emulator: add decoding of CMPXCHG8B dst operand Gleb Natapov
2010-03-21 14:41 ` Avi Kivity
2010-03-21 14:44 ` Gleb Natapov [this message]
2010-03-21 14:46 ` Avi Kivity
2010-03-23 12:33 ` Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2010-03-21 11:06 [PATCH 1/2] KVM: x86 emulator: commit rflags as part of registers commit Gleb Natapov
2010-03-21 11:06 ` [PATCH 2/2] KVM: x86 emulator: add decoding of CMPXCHG8B dst operand Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100321144425.GG13522@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox