From: Avi Kivity Subject: [PATCH 2/7] KVM: x86 emulator: move invlpg emulation into a function Date: Sun, 3 Apr 2011 14:23:50 +0300 Message-ID: <1301829835-29029-3-git-send-email-avi@redhat.com> References: <1301829835-29029-1-git-send-email-avi@redhat.com> To: Marcelo Tosatti , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:63651 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751824Ab1DCLYQ (ORCPT ); Sun, 3 Apr 2011 07:24:16 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p33BOGxO013647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 3 Apr 2011 07:24:16 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p33BOF5i005365 for ; Sun, 3 Apr 2011 07:24:16 -0400 In-Reply-To: <1301829835-29029-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: It's going to get more complicated soon. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7a1cc3c..95291fc 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2451,6 +2451,15 @@ static int em_movdqu(struct x86_emulate_ctxt *ctxt) return X86EMUL_CONTINUE; } +static int em_invlpg(struct x86_emulate_ctxt *ctxt) +{ + struct decode_cache *c = &ctxt->decode; + emulate_invlpg(ctxt->vcpu, linear(ctxt, c->src.addr.mem)); + /* Disable writeback. */ + c->dst.type = OP_NONE; + return X86EMUL_CONTINUE; +} + #define D(_y) { .flags = (_y) } #define N D(0) #define G(_f, _g) { .flags = ((_f) | Group), .u.group = (_g) } @@ -3658,10 +3667,7 @@ twobyte_insn: rc = X86EMUL_PROPAGATE_FAULT; goto done; case 7: /* invlpg*/ - emulate_invlpg(ctxt->vcpu, - linear(ctxt, c->src.addr.mem)); - /* Disable writeback. */ - c->dst.type = OP_NONE; + rc = em_invlpg(ctxt); break; default: goto cannot_emulate; -- 1.7.1