KVM: fix emulator_task_switch() return value.

emulator_task_switch() should return -1 for failure and 0 for success to
the caller, just like x86_emulate_insn() does.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Gleb Natapov
2010-04-15 12:29:50 +03:00
committed by Avi Kivity
parent 5b7e0102ae
commit 19d0443726
2 changed files with 5 additions and 4 deletions

View File

@@ -4800,10 +4800,11 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason,
tss_selector, reason, has_error_code,
error_code);
if (ret == X86EMUL_CONTINUE)
kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
if (ret)
return EMULATE_FAIL;
return (ret != X86EMUL_CONTINUE);
kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
return EMULATE_DONE;
}
EXPORT_SYMBOL_GPL(kvm_task_switch);