From patchwork Wed Jun 17 13:50:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 30878 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 n5HDlban005228 for ; Wed, 17 Jun 2009 13:47:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762387AbZFQNra (ORCPT ); Wed, 17 Jun 2009 09:47:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760436AbZFQNra (ORCPT ); Wed, 17 Jun 2009 09:47:30 -0400 Received: from sg2ehsobe004.messaging.microsoft.com ([207.46.51.78]:35394 "EHLO SG2EHSOBE004.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757704AbZFQNr3 (ORCPT ); Wed, 17 Jun 2009 09:47:29 -0400 Received: from mail78-sin-R.bigfish.com (10.210.100.244) by SG2EHSOBE004.bigfish.com (10.210.112.24) with Microsoft SMTP Server id 8.1.340.0; Wed, 17 Jun 2009 13:47:31 +0000 Received: from mail78-sin (localhost.localdomain [127.0.0.1]) by mail78-sin-R.bigfish.com (Postfix) with ESMTP id 56AB47D0069; Wed, 17 Jun 2009 13:47:31 +0000 (UTC) X-SpamScore: 1 X-BigFish: VPS1(zzzz1202hzzz32i17ch65h) X-Spam-TCS-SCL: 4:0 Received: by mail78-sin (MessageSwitch) id 1245246450377122_31817; Wed, 17 Jun 2009 13:47:30 +0000 (UCT) Received: from ausb3extmailp02.amd.com (ausb3extmailp02.amd.com [163.181.251.22]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail78-sin.bigfish.com (Postfix) with ESMTP id A419913B8057; Wed, 17 Jun 2009 13:47:29 +0000 (UTC) Received: from ausb3twp01.amd.com (ausb3twp01.amd.com [163.181.250.37]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n5HDlNfl016182; Wed, 17 Jun 2009 08:47:26 -0500 X-WSS-ID: 0KLDYAS-01-X0R-01 Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp01.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 2E8521943D0; Wed, 17 Jun 2009 08:47:15 -0500 (CDT) Received: from SAUSEXMB3.amd.com ([163.181.22.202]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Jun 2009 08:47:22 -0500 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by SAUSEXMB3.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Jun 2009 08:47:21 -0500 Received: from localhost.localdomain ([165.204.15.42]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Jun 2009 15:47:07 +0200 From: Andre Przywara To: avi@redhat.com CC: kvm@vger.kernel.org, Andre Przywara , Amit Shah , Christoph Egger Subject: [PATCH 3/6] prepare for emulation of syscall instructions Date: Wed, 17 Jun 2009 15:50:33 +0200 Message-ID: <1245246636-30760-4-git-send-email-andre.przywara@amd.com> X-Mailer: git-send-email 1.6.1.3 In-Reply-To: <1245246636-30760-1-git-send-email-andre.przywara@amd.com> References: <1245246636-30760-1-git-send-email-andre.przywara@amd.com> X-OriginalArrivalTime: 17 Jun 2009 13:47:07.0600 (UTC) FILETIME=[1AFE4D00:01C9EF52] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add the flags needed for syscall, sysenter and sysexit to the opcode table. Catch (but for now ignore) the opcodes in the emulation switch/case. Signed-off-by: Andre Przywara Signed-off-by: Amit Shah Signed-off-by: Christoph Egger --- arch/x86/kvm/x86_emulate.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index e387c83..328ccba 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -32,6 +32,8 @@ #include #include +#include "mmu.h" /* for is_long_mode() */ + /* * Opcode effective-address decode tables. * Note that we only emulate instructions that have at least one memory @@ -209,7 +211,7 @@ static u32 opcode_table[256] = { static u32 twobyte_table[256] = { /* 0x00 - 0x0F */ - 0, Group | GroupDual | Group7, 0, 0, 0, 0, ImplicitOps, 0, + 0, Group | GroupDual | Group7, 0, 0, 0, ImplicitOps, ImplicitOps, 0, ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, /* 0x10 - 0x1F */ 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, @@ -217,7 +219,9 @@ static u32 twobyte_table[256] = { ModRM | ImplicitOps, ModRM, ModRM | ImplicitOps, ModRM, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3F */ - ImplicitOps, 0, ImplicitOps, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ImplicitOps, 0, ImplicitOps, 0, + ImplicitOps, ImplicitOps, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x47 */ DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, @@ -1988,6 +1992,9 @@ twobyte_insn: goto cannot_emulate; } break; + case 0x05: /* syscall */ + goto cannot_emulate; + break; case 0x06: emulate_clts(ctxt->vcpu); c->dst.type = OP_NONE; @@ -2054,6 +2061,12 @@ twobyte_insn: rc = X86EMUL_CONTINUE; c->dst.type = OP_NONE; break; + case 0x34: /* sysenter */ + goto cannot_emulate; + break; + case 0x35: /* sysexit */ + goto cannot_emulate; + break; case 0x40 ... 0x4f: /* cmov */ c->dst.val = c->dst.orig_val = c->src.val; if (!test_cc(c->b, ctxt->eflags))