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 5/9] KVM: SVM: Add checks for all group 7 instructions
Date
This patch adds intercept checks for all the group 7
instructions to the KVM instruction emulator path.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kvm/svm.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 035c5b5..7284193 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3619,6 +3619,55 @@ static void svm_fpu_deactivate(struct kvm_vcpu *vcpu)
update_cr0_intercept(svm);
}

+static void svm_check_group7(struct vmcb *vmcb, struct x86_emulate_ctxt *ctxt)
+{
+ struct decode_cache *c = &ctxt->decode;
+
+ switch (c->modrm_rm) {
+ case 0:
+ switch (c->modrm_reg) {
+ case 1:
+ vmcb->control.exit_code = SVM_EXIT_MONITOR;
+ break;
+ case 3:
+ vmcb->control.exit_code = SVM_EXIT_VMRUN;
+ break;
+ }
+ break;
+ case 1:
+ switch (c->modrm_reg) {
+ case 1:
+ vmcb->control.exit_code = SVM_EXIT_MWAIT;
+ break;
+ case 3:
+ vmcb->control.exit_code = SVM_EXIT_VMMCALL;
+ break;
+ case 7:
+ vmcb->control.exit_code = SVM_EXIT_RDTSCP;
+ break;
+ }
+ break;
+ case 2:
+ vmcb->control.exit_code = SVM_EXIT_VMLOAD;
+ break;
+ case 3:
+ vmcb->control.exit_code = SVM_EXIT_VMSAVE;
+ break;
+ case 4:
+ vmcb->control.exit_code = SVM_EXIT_STGI;
+ break;
+ case 5:
+ vmcb->control.exit_code = SVM_EXIT_CLGI;
+ break;
+ case 6:
+ vmcb->control.exit_code = SVM_EXIT_SKINIT;
+ break;
+ case 7:
+ vmcb->control.exit_code = SVM_EXIT_INVLPGA;
+ break;
+ }
+}
+
static int svm_insn_intercepted(struct kvm_vcpu *vcpu,
struct x86_emulate_ctxt *ctxt)
{
@@ -3654,8 +3703,10 @@ static int svm_insn_intercepted(struct kvm_vcpu *vcpu,
break;
case 0x01:
/* 0x0f 0x01 and modrm_mod == 3 encodes special instructions */
- if (c->modrm_mod == 3)
+ if (c->modrm_mod == 3) {
+ svm_check_group7(vmcb, ctxt);
break;
+ }

switch (c->modrm_reg) {
case 0x00: /* SGDT */
--
1.7.1



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