aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-07-29 08:11:52 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:50:27 -0400
commite85d28f8e8cef09b8e424448ccedb7244cfbf147 (patch)
tree64d4b0ee60ee1999a828db8967b806c70ad18521 /arch/x86/kvm/x86.c
parent63540382ccb83d2857964858c1ac7eb7d37de497 (diff)
KVM: x86 emulator: don't update vcpu state if instruction is restarted
No need to update vcpu state since instruction is in the middle of the emulation. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 33deb75f16ee..3cbe8032394a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4057,32 +4057,27 @@ restart:
4057 return handle_emulation_failure(vcpu); 4057 return handle_emulation_failure(vcpu);
4058 } 4058 }
4059 4059
4060 toggle_interruptibility(vcpu, vcpu->arch.emulate_ctxt.interruptibility); 4060 r = EMULATE_DONE;
4061 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
4062 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs);
4063 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
4064 4061
4065 if (vcpu->arch.emulate_ctxt.exception >= 0) { 4062 if (vcpu->arch.emulate_ctxt.exception >= 0)
4066 inject_emulated_exception(vcpu); 4063 inject_emulated_exception(vcpu);
4067 return EMULATE_DONE; 4064 else if (vcpu->arch.pio.count) {
4068 }
4069
4070 if (vcpu->arch.pio.count) {
4071 if (!vcpu->arch.pio.in) 4065 if (!vcpu->arch.pio.in)
4072 vcpu->arch.pio.count = 0; 4066 vcpu->arch.pio.count = 0;
4073 return EMULATE_DO_MMIO; 4067 r = EMULATE_DO_MMIO;
4074 } 4068 } else if (vcpu->mmio_needed) {
4075
4076 if (vcpu->mmio_needed) {
4077 if (vcpu->mmio_is_write) 4069 if (vcpu->mmio_is_write)
4078 vcpu->mmio_needed = 0; 4070 vcpu->mmio_needed = 0;
4079 return EMULATE_DO_MMIO; 4071 r = EMULATE_DO_MMIO;
4080 } 4072 } else if (vcpu->arch.emulate_ctxt.restart)
4081
4082 if (vcpu->arch.emulate_ctxt.restart)
4083 goto restart; 4073 goto restart;
4084 4074
4085 return EMULATE_DONE; 4075 toggle_interruptibility(vcpu, vcpu->arch.emulate_ctxt.interruptibility);
4076 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
4077 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs);
4078 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
4079
4080 return r;
4086} 4081}
4087EXPORT_SYMBOL_GPL(emulate_instruction); 4082EXPORT_SYMBOL_GPL(emulate_instruction);
4088 4083