From patchwork Sat Apr 23 09:51:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 728951 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 p3N9pEj3003054 for ; Sat, 23 Apr 2011 09:51:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752877Ab1DWJvM (ORCPT ); Sat, 23 Apr 2011 05:51:12 -0400 Received: from mail-px0-f179.google.com ([209.85.212.179]:64670 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752861Ab1DWJvL (ORCPT ); Sat, 23 Apr 2011 05:51:11 -0400 Received: by pxi2 with SMTP id 2so908461pxi.10 for ; Sat, 23 Apr 2011 02:51:11 -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=/Bf0GxYvsoPtDlAhy1fcxcrnV0xs6d79wwQisrCHcMU=; b=JOWIsvbi6Z31/Nwn7CqFA3E3y1CL34I6QYsrns9E8tUaFGa8ZC5QLb53U1zWffTHuu PBqsdD2B/+hZl9StRj4SwskYDaQc9PzGdhK9CBUJOAZIPM9ilZQt1ywlg0TfU/8eA+40 mbbDchFcjrpOf18NPQtcWTuRaHNURmfxODv2s= 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=wt6X6M6itww5zLxzOhrkYJFQa4LX++0sgsd/nWS8X6ET2MFFrMJ1H6En6aCreVbpx1 ACN9ahEo2S9IzloE8GGDkOF7dQviscu3mBYgqv0L52GIEkNt5IveANnTocoxr9KUWXF2 K6bXCW07gxl/yIScIJXGzzagI4IJRv7b9S0lM= Received: by 10.68.14.167 with SMTP id q7mr233085pbc.430.1303552271100; Sat, 23 Apr 2011 02:51:11 -0700 (PDT) Received: from amd (s198099.dynamic.ppp.asahi-net.or.jp [220.157.198.99]) by mx.google.com with ESMTPS id i10sm2567665pbd.28.2011.04.23.02.51.08 (version=SSLv3 cipher=OTHER); Sat, 23 Apr 2011 02:51:10 -0700 (PDT) Date: Sat, 23 Apr 2011 18:51:07 +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 3/4] KVM: x86 emulator: Use opcode::execute for PUSHA/POPA (60/61) Message-Id: <20110423185107.087819db.takuya.yoshikawa@gmail.com> In-Reply-To: <20110423184549.025d4831.takuya.yoshikawa@gmail.com> References: <20110423184549.025d4831.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]); Sat, 23 Apr 2011 09:51:15 +0000 (UTC) From: Takuya Yoshikawa For this, emulate_pusha/popa() are converted to em_pusha/popa(). Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 9936751..3cb6aec 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1473,7 +1473,7 @@ static int emulate_pop_sreg(struct x86_emulate_ctxt *ctxt, return rc; } -static int emulate_pusha(struct x86_emulate_ctxt *ctxt) +static int em_pusha(struct x86_emulate_ctxt *ctxt) { struct decode_cache *c = &ctxt->decode; unsigned long old_esp = c->regs[VCPU_REGS_RSP]; @@ -1494,8 +1494,7 @@ static int emulate_pusha(struct x86_emulate_ctxt *ctxt) return rc; } -static int emulate_popa(struct x86_emulate_ctxt *ctxt, - struct x86_emulate_ops *ops) +static int em_popa(struct x86_emulate_ctxt *ctxt) { struct decode_cache *c = &ctxt->decode; int rc = X86EMUL_CONTINUE; @@ -1508,7 +1507,7 @@ static int emulate_popa(struct x86_emulate_ctxt *ctxt, --reg; } - rc = emulate_pop(ctxt, ops, &c->regs[reg], c->op_bytes); + rc = emulate_pop(ctxt, ctxt->ops, &c->regs[reg], c->op_bytes); if (rc != X86EMUL_CONTINUE) break; --reg; @@ -3012,7 +3011,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 */ @@ -3738,12 +3738,6 @@ special_insn: case 0x48 ... 0x4f: /* dec r16/r32 */ emulate_1op("dec", c->dst, ctxt->eflags); break; - case 0x60: /* pusha */ - rc = emulate_pusha(ctxt); - break; - case 0x61: /* popa */ - rc = emulate_popa(ctxt, ops); - break; case 0x63: /* movsxd */ if (ctxt->mode != X86EMUL_MODE_PROT64) goto cannot_emulate;