From patchwork Sun Mar 13 15:21:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 631791 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2DFM0au006243 for ; Sun, 13 Mar 2011 15:22:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753058Ab1CMPV5 (ORCPT ); Sun, 13 Mar 2011 11:21:57 -0400 Received: from mail-gw0-f46.google.com ([74.125.83.46]:60098 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752404Ab1CMPV5 (ORCPT ); Sun, 13 Mar 2011 11:21:57 -0400 Received: by gwaa18 with SMTP id a18so1528800gwa.19 for ; Sun, 13 Mar 2011 08:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding; bh=AxQ6CWG+C7yhQg8guA+lrbPY4Bqzlq0iaAp64/Pa3a4=; b=LMQ7QGuoc0rIy398vmubprJlqw0UUcG6RSlVr+Yp/NPHHqh6KZQsg8A1zpgNprLpE0 lK28IFFx/nahDond/ogONRMNFy3fHW4Svsj4K5i2+P/qPuO62S8/SQzoXTN2LwSNw6ep Y2Ic/MVtNqXqIz2FvWHxZOMw96qlrnEtUu3pk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=ctzTpN+8yz4t6zMM+V1HlpnQL5zcaL4S/nW8OZ/J35CjPxFETX99jOMs2Y8tvhIqM4 YZFxVfyRcByLwr5ukJQ0rP7fIh0mGmCIVK9fvZiECGCMtRPfwKOQbgJYHvko9dIx3zy6 CN2V24oURaJf42E0ocI3O8oHvQG5A/3P3fz1w= Received: by 10.236.182.200 with SMTP id o48mr763545yhm.315.1300029716778; Sun, 13 Mar 2011 08:21:56 -0700 (PDT) Received: from amd (u061190.dynamic.ppp.asahi-net.or.jp [203.212.61.190]) by mx.google.com with ESMTPS id x75sm3378538yhn.24.2011.03.13.08.21.54 (version=SSLv3 cipher=OTHER); Sun, 13 Mar 2011 08:21:56 -0700 (PDT) Date: Mon, 14 Mar 2011 00:21:52 +0900 From: Takuya Yoshikawa To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp, gleb@redhat.com Subject: [PATCH 4/5] KVM: x86 emulator: Use single stage decoding for PUSHA and POPA instructions Message-Id: <20110314002152.fc032e5d.takuya.yoshikawa@gmail.com> In-Reply-To: <20110314001524.f35e8a3f.takuya.yoshikawa@gmail.com> References: <20110314001524.f35e8a3f.takuya.yoshikawa@gmail.com> X-Mailer: Sylpheed 3.1.0beta2 (GTK+ 2.22.0; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 13 Mar 2011 15:22:00 +0000 (UTC) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 8295c50..4e16a55 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2224,6 +2224,11 @@ static int em_push_gs(struct x86_emulate_ctxt *ctxt) return X86EMUL_CONTINUE; } +static int em_pusha(struct x86_emulate_ctxt *ctxt) +{ + return emulate_pusha(ctxt, ctxt->ops); +} + static int em_pop(struct x86_emulate_ctxt *ctxt) { struct decode_cache *c = &ctxt->decode; @@ -2256,6 +2261,11 @@ static int em_pop_gs(struct x86_emulate_ctxt *ctxt) return emulate_pop_sreg(ctxt, ctxt->ops, VCPU_SREG_GS); } +static int em_popa(struct x86_emulate_ctxt *ctxt) +{ + return emulate_popa(ctxt, ctxt->ops); +} + static int em_das(struct x86_emulate_ctxt *ctxt) { struct decode_cache *c = &ctxt->decode; @@ -2567,7 +2577,8 @@ static struct opcode opcode_table[256] = { /* 0x58 - 0x5F */ X8(I(DstReg | Stack, em_pop)), /* 0x60 - 0x67 */ - D(ImplicitOps | Stack | No64), D(ImplicitOps | Stack | No64), + I(ImplicitOps | Stack | No64, em_pusha), + I(ImplicitOps | Stack | No64, em_popa), N, D(DstReg | SrcMem32 | ModRM | Mov) /* movsxd (x86/64) */ , N, N, N, N, /* 0x68 - 0x6F */ @@ -3188,12 +3199,6 @@ special_insn: case 0x48 ... 0x4f: /* dec r16/r32 */ emulate_1op("dec", c->dst, ctxt->eflags); break; - case 0x60: /* pusha */ - rc = emulate_pusha(ctxt, ops); - break; - case 0x61: /* popa */ - rc = emulate_popa(ctxt, ops); - break; case 0x63: /* movsxd */ if (ctxt->mode != X86EMUL_MODE_PROT64) goto cannot_emulate;