From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: [PATCH 4/5] KVM: x86 emulator: Use single stage decoding for PUSHA and POPA instructions Date: Mon, 14 Mar 2011 00:21:52 +0900 Message-ID: <20110314002152.fc032e5d.takuya.yoshikawa@gmail.com> References: <20110314001524.f35e8a3f.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-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) In-Reply-To: <20110314001524.f35e8a3f.takuya.yoshikawa@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Takuya Yoshikawa PUSHA and POPA are converted. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) 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; -- 1.7.1