From patchwork Sun Apr 12 07:26:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 17779 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3C7R2NF023604 for ; Sun, 12 Apr 2009 07:27:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759146AbZDLH0P (ORCPT ); Sun, 12 Apr 2009 03:26:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759084AbZDLH0P (ORCPT ); Sun, 12 Apr 2009 03:26:15 -0400 Received: from mx2.redhat.com ([66.187.237.31]:34851 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758335AbZDLH0N (ORCPT ); Sun, 12 Apr 2009 03:26:13 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3C7QDUh024428 for ; Sun, 12 Apr 2009 03:26:13 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3C7QEbt010859; Sun, 12 Apr 2009 03:26:14 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3C7QC4P022549; Sun, 12 Apr 2009 03:26:12 -0400 Received: from trex.usersys.redhat.com (localhost [127.0.0.1]) by dhcp-1-237.tlv.redhat.com (Postfix) with ESMTP id F3DC218D41C; Sun, 12 Apr 2009 10:26:11 +0300 (IDT) From: Gleb Natapov Subject: [PATCH v2 04/10] Complete short/near jcc decoding in decode stage. To: avi@redhat.com Cc: kvm@vger.kernel.org Date: Sun, 12 Apr 2009 10:26:11 +0300 Message-ID: <20090412072611.5828.2784.stgit@trex.usersys.redhat.com> In-Reply-To: <20090412072555.5828.46351.stgit@trex.usersys.redhat.com> References: <20090412072555.5828.46351.stgit@trex.usersys.redhat.com> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Gleb Natapov --- arch/x86/kvm/x86_emulate.c | 50 ++++++++++++++++---------------------------- 1 files changed, 18 insertions(+), 32 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 3026929..0ca8b60 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -136,11 +136,15 @@ static u32 opcode_table[256] = { SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* insb, insw/insd */ SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* outsb, outsw/outsd */ /* 0x70 - 0x77 */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, /* 0x78 - 0x7F */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, /* 0x80 - 0x87 */ Group | Group1_80, Group | Group1_81, Group | Group1_82, Group | Group1_83, @@ -232,10 +236,12 @@ static u32 twobyte_table[256] = { /* 0x70 - 0x7F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8F */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, /* 0x90 - 0x9F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 - 0xA7 */ @@ -1539,13 +1545,10 @@ special_insn: return -1; } return 0; - case 0x70 ... 0x7f: /* jcc (short) */ { - int rel = insn_fetch(s8, 1, c->eip); - + case 0x70 ... 0x7f: /* jcc (short) */ if (test_cc(c->b, ctxt->eflags)) - jmp_rel(c, rel); + jmp_rel(c, c->src.val); break; - } case 0x80 ... 0x83: /* Grp1 */ switch (c->modrm_reg) { case 0: @@ -2031,28 +2034,11 @@ twobyte_insn: if (!test_cc(c->b, ctxt->eflags)) c->dst.type = OP_NONE; /* no writeback */ break; - case 0x80 ... 0x8f: /* jnz rel, etc*/ { - long int rel; - - switch (c->op_bytes) { - case 2: - rel = insn_fetch(s16, 2, c->eip); - break; - case 4: - rel = insn_fetch(s32, 4, c->eip); - break; - case 8: - rel = insn_fetch(s64, 8, c->eip); - break; - default: - DPRINTF("jnz: Invalid op_bytes\n"); - goto cannot_emulate; - } + case 0x80 ... 0x8f: /* jnz rel, etc*/ if (test_cc(c->b, ctxt->eflags)) - jmp_rel(c, rel); + jmp_rel(c, c->src.val); c->dst.type = OP_NONE; break; - } case 0xa3: bt: /* bt */ c->dst.type = OP_NONE;