From: Takuya Yoshikawa Subject: [PATCH 1/3 v2] KVM: x86 emulator: Disable writeback for CMP emulation Date: Wed, 13 Apr 2011 00:24:55 +0900 Message-ID: <20110413002455.f2160cd3.takuya.yoshikawa@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp, gleb@redhat.com To: avi@redhat.com, mtosatti@redhat.com Return-path: Received: from mail-vw0-f46.google.com ([209.85.212.46]:53852 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757477Ab1DLPZC (ORCPT ); Tue, 12 Apr 2011 11:25:02 -0400 Received: by vws1 with SMTP id 1so5130087vws.19 for ; Tue, 12 Apr 2011 08:25:02 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: From: Takuya Yoshikawa This stops "CMP r/m, reg" to write back the data into memory. Pointed out by Avi. The writeback suppression now covers CMP, CMPS, SCAS. Signed-off-by: Takuya Yoshikawa --- Changelog v1->v2: moved the line just after the cmp label. arch/x86/kvm/emulate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 3e8b4ab..db48e91 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3671,6 +3671,7 @@ special_insn: break; case 0x38 ... 0x3d: cmp: /* cmp */ + c->dst.type = OP_NONE; /* Disable writeback. */ emulate_2op_SrcV("cmp", c->src, c->dst, ctxt->eflags); break; case 0x40 ... 0x47: /* inc r16/r32 */ @@ -3797,7 +3798,6 @@ special_insn: rc = emulate_popf(ctxt, ops, &c->dst.val, c->op_bytes); break; case 0xa6 ... 0xa7: /* cmps */ - c->dst.type = OP_NONE; /* Disable writeback. */ goto cmp; case 0xa8 ... 0xa9: /* test ax, imm */ goto test; -- 1.7.1