From patchwork Sun May 29 13:00:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 827712 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 p4TD0TDe031681 for ; Sun, 29 May 2011 13:00:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753530Ab1E2NA1 (ORCPT ); Sun, 29 May 2011 09:00:27 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:51934 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753537Ab1E2NA0 (ORCPT ); Sun, 29 May 2011 09:00:26 -0400 Received: by pwi15 with SMTP id 15so1326015pwi.19 for ; Sun, 29 May 2011 06:00:26 -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=lC28DF60Ec+fwxVO4+KkgzwsUrcmoFLqcM5yE/GA8gQ=; b=NBfSu1E7RWCK8ALs3VSbRI6rdOXPsFUGqBrJ3+W0u2v1UcBiuWjfMbpgwNGaJx5UtB pdXdm1Q4wBS3ACVX2CA4RWza3h7AEqDEpCfcpPrGkAQNWxzqjqvuSu1mTjAKoblIPVdf +b8yjYZA1a4lc06JnrDvPyo5axzmVfC8jjwqM= 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=OuAZvhYxzIW2GlwSbigj4RTK8gSuGFUQBxqAdCm8iGzueJIfIzmdAcn9onfpeBbTc8 kvZkL1TfeZTQ41jUeO+HuGrk3qvNIj9MAJWnx5OAo6cVeKgsRfS5t6UNWFXZH6WF+h06 wOjdkpYjDbWMuINdGG9fQAFZvt16e9NAYS9yg= Received: by 10.68.15.36 with SMTP id u4mr1616791pbc.20.1306674026015; Sun, 29 May 2011 06:00:26 -0700 (PDT) Received: from amd (x096101.dynamic.ppp.asahi-net.or.jp [122.249.96.101]) by mx.google.com with ESMTPS id p5sm2051929pbk.52.2011.05.29.06.00.23 (version=SSLv3 cipher=OTHER); Sun, 29 May 2011 06:00:25 -0700 (PDT) Date: Sun, 29 May 2011 22:00:22 +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 06/10] KVM: x86 emulator: Use opcode::execute for RET(C3) Message-Id: <20110529220022.5b6d6401.takuya.yoshikawa@gmail.com> In-Reply-To: <20110529215200.17be7761.takuya.yoshikawa@gmail.com> References: <20110529215200.17be7761.takuya.yoshikawa@gmail.com> X-Mailer: Sylpheed 3.1.0 (GTK+ 2.24.4; 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, 29 May 2011 13:00:30 +0000 (UTC) From: Takuya Yoshikawa Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 16c7507..759ec7c 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1814,6 +1814,16 @@ static int em_grp9(struct x86_emulate_ctxt *ctxt) return X86EMUL_CONTINUE; } +static int em_ret(struct x86_emulate_ctxt *ctxt) +{ + struct decode_cache *c = &ctxt->decode; + + c->dst.type = OP_REG; + c->dst.addr.reg = &c->eip; + c->dst.bytes = c->op_bytes; + return em_pop(ctxt); +} + static int em_ret_far(struct x86_emulate_ctxt *ctxt) { struct decode_cache *c = &ctxt->decode; @@ -3186,7 +3196,7 @@ static struct opcode opcode_table[256] = { /* 0xC0 - 0xC7 */ D2bv(DstMem | SrcImmByte | ModRM), I(ImplicitOps | Stack | SrcImmU16, em_ret_near_imm), - D(ImplicitOps | Stack), + I(ImplicitOps | Stack, em_ret), D(DstReg | SrcMemFAddr | ModRM | No64), D(DstReg | SrcMemFAddr | ModRM | No64), G(ByteOp, group11), G(0, group11), /* 0xC8 - 0xCF */ @@ -3927,12 +3937,6 @@ special_insn: case 0xc0 ... 0xc1: rc = em_grp2(ctxt); break; - case 0xc3: /* ret */ - c->dst.type = OP_REG; - c->dst.addr.reg = &c->eip; - c->dst.bytes = c->op_bytes; - rc = em_pop(ctxt); - break; case 0xc4: /* les */ rc = emulate_load_segment(ctxt, VCPU_SREG_ES); break;