@@ -2437,7 +2437,7 @@ int emulator_task_switch(struct x86_emulate_ctxt *ctxt,
kvm_rip_write(ctxt->vcpu, c->eip);
}
- return rc;
+ return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
}
static void string_addr_inc(struct x86_emulate_ctxt *ctxt, unsigned long base,
@@ -4811,10 +4811,11 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
ret = emulator_task_switch(&vcpu->arch.emulate_ctxt, &emulate_ops,
tss_selector, reason);
- 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);