KVM: Use the generic skip_emulated_instruction() in hypercall code
authorDor Laor <dor.laor@qumranet.com>
Mon, 19 Feb 2007 16:25:43 +0000 (18:25 +0200)
committerAvi Kivity <avi@qumranet.com>
Thu, 3 May 2007 07:52:22 +0000 (10:52 +0300)
Instead of twiddling the rip registers directly, use the
skip_emulated_instruction() function to do that for us.

Signed-off-by: Dor Laor <dor.laor@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/svm.c
drivers/kvm/vmx.c

index 3d8ea7ac2ecc308cded7d2b5f78473ff64f29a0f..6787f11738cfa8d376b909f96cefa007f3db8d2b 100644 (file)
@@ -1078,7 +1078,8 @@ static int halt_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 
 static int vmmcall_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 {
-       vcpu->svm->vmcb->save.rip += 3;
+       vcpu->svm->next_rip = vcpu->svm->vmcb->save.rip + 3;
+       skip_emulated_instruction(vcpu);
        return kvm_hypercall(vcpu, kvm_run);
 }
 
index fbbf9d6b299fa16bed8f89a677dc393bc1c55ee1..a721b60f7385b87d16fb1de729c8954a03f0824b 100644 (file)
@@ -1658,7 +1658,7 @@ static int handle_halt(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 
 static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 {
-       vmcs_writel(GUEST_RIP, vmcs_readl(GUEST_RIP)+3);
+       skip_emulated_instruction(vcpu);
        return kvm_hypercall(vcpu, kvm_run);
 }