From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/2] KVM: x86 emulator: Disable writeback for CMP emulation Date: Sun, 03 Apr 2011 17:42:35 +0300 Message-ID: <4D98875B.9050005@redhat.com> References: <20110329013229.20e6168f.takuya.yoshikawa@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp, gleb@redhat.com To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49183 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750902Ab1DCOml (ORCPT ); Sun, 3 Apr 2011 10:42:41 -0400 In-Reply-To: <20110329013229.20e6168f.takuya.yoshikawa@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 03/28/2011 06:32 PM, Takuya Yoshikawa wrote: > From: Takuya Yoshikawa > > This stops "CMP r/m, reg" to write back the data into memory. > Pointed out by Avi. > > Signed-off-by: Takuya Yoshikawa > --- > arch/x86/kvm/emulate.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > index 14c5ad5..8a73805 100644 > --- a/arch/x86/kvm/emulate.c > +++ b/arch/x86/kvm/emulate.c > @@ -3084,6 +3084,7 @@ special_insn: > emulate_2op_SrcV("xor", c->src, c->dst, ctxt->eflags); > break; > case 0x38 ... 0x3d: > + c->dst.type = OP_NONE; /* Disable writeback. */ > cmp: /* cmp */ Why not disable writeback here? As a prelude to having em_cmp() which does everything? I see SCAS also does a 'goto cmp', but it also benefits from disabling writeback. > emulate_2op_SrcV("cmp", c->src, c->dst, ctxt->eflags); > break; > @@ -3138,6 +3139,7 @@ special_insn: > case 6: > goto xor; > case 7: > + c->dst.type = OP_NONE; /* Disable writeback. */ > goto cmp; > } > break; -- error compiling committee.c: too many arguments to function