Commit 8317c298 authored by Gleb Natapov's avatar Gleb Natapov Committed by Avi Kivity

KVM: SVM: Skip instruction on a task switch only when appropriate

If a task switch was initiated because off a task gate in IDT and IDT
was accessed because of an external even the instruction should not
be skipped.
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent ba8afb6b
...@@ -1828,6 +1828,7 @@ static int task_switch_interception(struct vcpu_svm *svm, ...@@ -1828,6 +1828,7 @@ static int task_switch_interception(struct vcpu_svm *svm,
int reason; int reason;
int int_type = svm->vmcb->control.exit_int_info & int int_type = svm->vmcb->control.exit_int_info &
SVM_EXITINTINFO_TYPE_MASK; SVM_EXITINTINFO_TYPE_MASK;
int int_vec = svm->vmcb->control.exit_int_info & SVM_EVTINJ_VEC_MASK;
tss_selector = (u16)svm->vmcb->control.exit_info_1; tss_selector = (u16)svm->vmcb->control.exit_info_1;
...@@ -1843,8 +1844,14 @@ static int task_switch_interception(struct vcpu_svm *svm, ...@@ -1843,8 +1844,14 @@ static int task_switch_interception(struct vcpu_svm *svm,
reason = TASK_SWITCH_CALL; reason = TASK_SWITCH_CALL;
if (reason != TASK_SWITCH_GATE || int_type == SVM_EXITINTINFO_TYPE_SOFT) if (reason != TASK_SWITCH_GATE ||
skip_emulated_instruction(&svm->vcpu); int_type == SVM_EXITINTINFO_TYPE_SOFT ||
(int_type == SVM_EXITINTINFO_TYPE_EXEPT &&
(int_vec == OF_VECTOR || int_vec == BP_VECTOR))) {
if (emulate_instruction(&svm->vcpu, kvm_run, 0, 0,
EMULTYPE_SKIP) != EMULATE_DONE)
return 0;
}
return kvm_task_switch(&svm->vcpu, tss_selector, reason); return kvm_task_switch(&svm->vcpu, tss_selector, reason);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment