Commit 19d04437 authored by Gleb Natapov's avatar Gleb Natapov Committed by Avi Kivity

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: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 5b7e0102
...@@ -2453,7 +2453,7 @@ int emulator_task_switch(struct x86_emulate_ctxt *ctxt, ...@@ -2453,7 +2453,7 @@ int emulator_task_switch(struct x86_emulate_ctxt *ctxt,
rc = writeback(ctxt, ops); rc = writeback(ctxt, ops);
} }
return rc; return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
} }
static void string_addr_inc(struct x86_emulate_ctxt *ctxt, unsigned long base, static void string_addr_inc(struct x86_emulate_ctxt *ctxt, unsigned long base,
......
...@@ -4800,10 +4800,11 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason, ...@@ -4800,10 +4800,11 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason,
tss_selector, reason, has_error_code, tss_selector, reason, has_error_code,
error_code); error_code);
if (ret == X86EMUL_CONTINUE) if (ret)
kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); 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); EXPORT_SYMBOL_GPL(kvm_task_switch);
......
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