aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorSerge E. Hallyn <serge@hallyn.com>2011-04-13 10:12:54 -0400
committerAvi Kivity <avi@redhat.com>2011-05-11 07:57:09 -0400
commit71f9833bb1cba9939245f3e57388d87d69f8f399 (patch)
tree763f0afa1ad42902549d5484bc565e10a0a4683b /arch/x86/kvm/vmx.c
parent4487b3b48d8fa3f6a5dd4155c9e34d5e998ad7fe (diff)
KVM: fix push of wrong eip when doing softint
When doing a soft int, we need to bump eip before pushing it to the stack. Otherwise we'll do the int a second time. [apw@canonical.com: merged eip update as per Jan's recommendation.] Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index af5206983154..3f6e9bff0160 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1063,7 +1063,10 @@ static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
1063 } 1063 }
1064 1064
1065 if (vmx->rmode.vm86_active) { 1065 if (vmx->rmode.vm86_active) {
1066 if (kvm_inject_realmode_interrupt(vcpu, nr) != EMULATE_DONE) 1066 int inc_eip = 0;
1067 if (kvm_exception_is_soft(nr))
1068 inc_eip = vcpu->arch.event_exit_inst_len;
1069 if (kvm_inject_realmode_interrupt(vcpu, nr, inc_eip) != EMULATE_DONE)
1067 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); 1070 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
1068 return; 1071 return;
1069 } 1072 }
@@ -2942,7 +2945,10 @@ static void vmx_inject_irq(struct kvm_vcpu *vcpu)
2942 2945
2943 ++vcpu->stat.irq_injections; 2946 ++vcpu->stat.irq_injections;
2944 if (vmx->rmode.vm86_active) { 2947 if (vmx->rmode.vm86_active) {
2945 if (kvm_inject_realmode_interrupt(vcpu, irq) != EMULATE_DONE) 2948 int inc_eip = 0;
2949 if (vcpu->arch.interrupt.soft)
2950 inc_eip = vcpu->arch.event_exit_inst_len;
2951 if (kvm_inject_realmode_interrupt(vcpu, irq, inc_eip) != EMULATE_DONE)
2946 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); 2952 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
2947 return; 2953 return;
2948 } 2954 }
@@ -2977,7 +2983,7 @@ static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
2977 ++vcpu->stat.nmi_injections; 2983 ++vcpu->stat.nmi_injections;
2978 vmx->nmi_known_unmasked = false; 2984 vmx->nmi_known_unmasked = false;
2979 if (vmx->rmode.vm86_active) { 2985 if (vmx->rmode.vm86_active) {
2980 if (kvm_inject_realmode_interrupt(vcpu, NMI_VECTOR) != EMULATE_DONE) 2986 if (kvm_inject_realmode_interrupt(vcpu, NMI_VECTOR, 0) != EMULATE_DONE)
2981 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); 2987 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
2982 return; 2988 return;
2983 } 2989 }