[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1290622715-8382-5-git-send-email-joerg.roedel@amd.com>
Date: Wed, 24 Nov 2010 19:18:30 +0100
From: Joerg Roedel <joerg.roedel@....com>
To: Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>
CC: <kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Joerg Roedel <joerg.roedel@....com>
Subject: [PATCH 4/9] KVM: SVM: Add intercept checks for descriptor table accesses
This patch adds checks for accesses to the descriptor table
base registers to the intruction emulator path of KVM.
Signed-off-by: Joerg Roedel <joerg.roedel@....com>
---
arch/x86/kvm/svm.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
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;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists