lkml.org 
[lkml]   [2010]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/9] KVM: SVM: Add intercept checks for descriptor table accesses
Date
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@amd.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



\
 
 \ /
  Last update: 2010-11-24 19:21    [W:0.040 / U:4.276 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site