@@ -7119,7 +7119,8 @@ void kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip)
}
EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt);
-static int handle_emulation_failure(struct kvm_vcpu *vcpu, int emulation_type)
+static int handle_emulation_failure(struct kvm_vcpu *vcpu, int emulation_type,
+ int emulation_reason)
{
++vcpu->stat.insn_emulation_fail;
trace_kvm_emulate_insn_failed(vcpu);
@@ -7132,7 +7133,8 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu, int emulation_type)
if (emulation_type & EMULTYPE_SKIP) {
vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
- vcpu->run->internal.ndata = 0;
+ vcpu->run->internal.data[0] = emulation_reason;
+ vcpu->run->internal.ndata = 1;
return 0;
}
@@ -7141,7 +7143,8 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu, int emulation_type)
if (!is_guest_mode(vcpu) && static_call(kvm_x86_get_cpl)(vcpu) == 0) {
vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
- vcpu->run->internal.ndata = 0;
+ vcpu->run->internal.data[0] = emulation_reason;
+ vcpu->run->internal.ndata = 1;
return 0;
}
@@ -7490,7 +7493,8 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
inject_emulated_exception(vcpu);
return 1;
}
- return handle_emulation_failure(vcpu, emulation_type);
+ return handle_emulation_failure(vcpu, emulation_type,
+ emulation_reason);
}
}
@@ -7547,7 +7551,8 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
emulation_type))
return 1;
- return handle_emulation_failure(vcpu, emulation_type);
+ return handle_emulation_failure(vcpu, emulation_type,
+ emulation_reason);
}
if (ctxt->have_exception) {