diff options
-rw-r--r-- | arch/x86/kvm/vmx.c | 12 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 5 | ||||
-rw-r--r-- | arch/x86/kvm/x86.h | 2 |
3 files changed, 13 insertions, 6 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 | } |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3416a3473849..b05e3fcce298 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -4423,7 +4423,7 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) | |||
4423 | vcpu->arch.emulate_regs_need_sync_from_vcpu = false; | 4423 | vcpu->arch.emulate_regs_need_sync_from_vcpu = false; |
4424 | } | 4424 | } |
4425 | 4425 | ||
4426 | int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq) | 4426 | int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip) |
4427 | { | 4427 | { |
4428 | struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode; | 4428 | struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode; |
4429 | int ret; | 4429 | int ret; |
@@ -4432,7 +4432,8 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq) | |||
4432 | 4432 | ||
4433 | vcpu->arch.emulate_ctxt.decode.op_bytes = 2; | 4433 | vcpu->arch.emulate_ctxt.decode.op_bytes = 2; |
4434 | vcpu->arch.emulate_ctxt.decode.ad_bytes = 2; | 4434 | vcpu->arch.emulate_ctxt.decode.ad_bytes = 2; |
4435 | vcpu->arch.emulate_ctxt.decode.eip = vcpu->arch.emulate_ctxt.eip; | 4435 | vcpu->arch.emulate_ctxt.decode.eip = vcpu->arch.emulate_ctxt.eip + |
4436 | inc_eip; | ||
4436 | ret = emulate_int_real(&vcpu->arch.emulate_ctxt, &emulate_ops, irq); | 4437 | ret = emulate_int_real(&vcpu->arch.emulate_ctxt, &emulate_ops, irq); |
4437 | 4438 | ||
4438 | if (ret != X86EMUL_CONTINUE) | 4439 | if (ret != X86EMUL_CONTINUE) |
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index c600da830ce0..e407ed3df817 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h | |||
@@ -77,7 +77,7 @@ static inline u32 bit(int bitno) | |||
77 | 77 | ||
78 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); | 78 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); |
79 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); | 79 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); |
80 | int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq); | 80 | int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip); |
81 | 81 | ||
82 | void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data); | 82 | void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data); |
83 | 83 | ||