public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] HYPERCALL] Update exit reason for vmcall
@ 2007-08-24 23:58 Dor Laor
       [not found] ` <64F9B87B6B770947A9F8391472E032160D59004E-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dor Laor @ 2007-08-24 23:58 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

It provides user space hypercall handling.
Also add cpl == 0 check for svm, htat unlike VT let software decide.

Signed-off-by: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
---
 drivers/kvm/kvm_main.c |    2 ++
 drivers/kvm/svm.c      |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index d154487..abd7498 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1305,6 +1305,8 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct
kvm_run *run)
 		run->hypercall.ret = ret;
 		run->hypercall.longmode = is_long_mode(vcpu);
 		kvm_arch_ops->decache_regs(vcpu);
+		run->exit_reason = KVM_EXIT_HYPERCALL;
+
 		return 0;
 	}
 	vcpu->regs[VCPU_REGS_RAX] = ret;
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index cc674bf..9bfd11e 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -1022,6 +1022,11 @@ static int halt_interception(struct vcpu_svm
*svm, struct kvm_run *kvm_run)
 
 static int vmmcall_interception(struct vcpu_svm *svm, struct kvm_run
*kvm_run)
 {
+	if (svm->vmcb->save.cpl != 0) {
+		inject_ud(&svm->vcpu);
+		return 1;
+	}
+
 	svm->next_rip = svm->vmcb->save.rip + 3;
 	skip_emulated_instruction(&svm->vcpu);
 	return kvm_hypercall(&svm->vcpu, kvm_run);

-----
In simplicity there is elegance.
Dor Laor ;)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-27 22:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-24 23:58 [PATCH 3/4] HYPERCALL] Update exit reason for vmcall Dor Laor
     [not found] ` <64F9B87B6B770947A9F8391472E032160D59004E-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-08-25  8:11   ` Avi Kivity
2007-08-27 22:16   ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox