From patchwork Wed Nov 24 18:18:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 353841 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 oAOIKJOm017532 for ; Wed, 24 Nov 2010 18:20:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755222Ab0KXSS6 (ORCPT ); Wed, 24 Nov 2010 13:18:58 -0500 Received: from db3ehsobe006.messaging.microsoft.com ([213.199.154.144]:2467 "EHLO DB3EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755194Ab0KXSS4 (ORCPT ); Wed, 24 Nov 2010 13:18:56 -0500 Received: from mail58-db3-R.bigfish.com (10.3.81.254) by DB3EHSOBE006.bigfish.com (10.3.84.26) with Microsoft SMTP Server id 14.1.225.8; Wed, 24 Nov 2010 18:18:53 +0000 Received: from mail58-db3 (localhost.localdomain [127.0.0.1]) by mail58-db3-R.bigfish.com (Postfix) with ESMTP id 90B87150026E; Wed, 24 Nov 2010 18:18:53 +0000 (UTC) X-SpamScore: -2 X-BigFish: VPS-2(zzbb2cKzz1202hzz8275bhz32i691h668h67dh685h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI Received: from mail58-db3 (localhost.localdomain [127.0.0.1]) by mail58-db3 (MessageSwitch) id 1290622733213084_29625; Wed, 24 Nov 2010 18:18:53 +0000 (UTC) Received: from DB3EHSMHS009.bigfish.com (unknown [10.3.81.245]) by mail58-db3.bigfish.com (Postfix) with ESMTP id 1CC1C49004C; Wed, 24 Nov 2010 18:18:53 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by DB3EHSMHS009.bigfish.com (10.3.87.109) with Microsoft SMTP Server id 14.1.225.8; Wed, 24 Nov 2010 18:18:42 +0000 X-WSS-ID: 0LCEIUZ-01-380-02 X-M-MSG: Received: from sausexedgep02.amd.com (sausexedgep02-ext.amd.com [163.181.249.73]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2132810288C4; Wed, 24 Nov 2010 12:18:34 -0600 (CST) Received: from sausexhtp01.amd.com (163.181.3.165) by sausexedgep02.amd.com (163.181.36.59) with Microsoft SMTP Server (TLS) id 8.3.106.1; Wed, 24 Nov 2010 12:19:46 -0600 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 24 Nov 2010 12:18:39 -0600 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Wed, 24 Nov 2010 13:18:38 -0500 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id B372D49C266; Wed, 24 Nov 2010 18:18:37 +0000 (GMT) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id BB368FFF1E; Wed, 24 Nov 2010 19:18:39 +0100 (CET) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: , , Joerg Roedel Subject: [PATCH 4/9] KVM: SVM: Add intercept checks for descriptor table accesses Date: Wed, 24 Nov 2010 19:18:30 +0100 Message-ID: <1290622715-8382-5-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1290622715-8382-1-git-send-email-joerg.roedel@amd.com> References: <1290622715-8382-1-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com 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.3 (demeter1.kernel.org [140.211.167.41]); Wed, 24 Nov 2010 18:20:32 +0000 (UTC) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 16ff569..035c5b5 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -3636,12 +3636,40 @@ static int svm_insn_intercepted(struct kvm_vcpu *vcpu, goto out; switch (c->b) { + case 0x00: + switch (c->modrm_reg) { + case 0x00: /* SLDT */ + vmcb->control.exit_code = SVM_EXIT_LDTR_READ; + break; + case 0x01: /* STR */ + vmcb->control.exit_code = SVM_EXIT_TR_READ; + break; + case 0x02: /* LLDT */ + vmcb->control.exit_code = SVM_EXIT_LDTR_WRITE; + break; + case 0x03: /* LTR */ + vmcb->control.exit_code = SVM_EXIT_TR_WRITE; + break; + } + break; case 0x01: /* 0x0f 0x01 and modrm_mod == 3 encodes special instructions */ if (c->modrm_mod == 3) break; switch (c->modrm_reg) { + case 0x00: /* SGDT */ + vmcb->control.exit_code = SVM_EXIT_GDTR_READ; + break; + case 0x01: /* SIDT */ + vmcb->control.exit_code = SVM_EXIT_IDTR_READ; + break; + case 0x02: /* LGDT */ + vmcb->control.exit_code = SVM_EXIT_GDTR_WRITE; + break; + case 0x03: /* LIDT */ + vmcb->control.exit_code = SVM_EXIT_IDTR_WRITE; + break; case 0x04: /* SMSW */ vmcb->control.exit_code = SVM_EXIT_READ_CR0; break;