aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-08-25 05:47:43 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:51:34 -0400
commitd2ddd1c48364e4161052d6089f06b2cf3c50496b (patch)
treef8dd6a949e5006e2f39575b567f22d9033b9d1a7 /arch/x86/kvm/x86.c
parent3e2f65d57a0c1897fcc3287eeb41f117f4d021e5 (diff)
KVM: x86 emulator: get rid of "restart" in emulation context.
x86_emulate_insn() will return 1 if instruction can be restarted without re-entering a guest. 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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d4d33f943d99..bc96ac9ed912 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4181,18 +4181,17 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
4181restart: 4181restart:
4182 r = x86_emulate_insn(&vcpu->arch.emulate_ctxt); 4182 r = x86_emulate_insn(&vcpu->arch.emulate_ctxt);
4183 4183
4184 if (r) { /* emulation failed */ 4184 if (r == EMULATION_FAILED) {
4185 if (reexecute_instruction(vcpu, cr2)) 4185 if (reexecute_instruction(vcpu, cr2))
4186 return EMULATE_DONE; 4186 return EMULATE_DONE;
4187 4187
4188 return handle_emulation_failure(vcpu); 4188 return handle_emulation_failure(vcpu);
4189 } 4189 }
4190 4190
4191 r = EMULATE_DONE; 4191 if (vcpu->arch.emulate_ctxt.exception >= 0) {
4192
4193 if (vcpu->arch.emulate_ctxt.exception >= 0)
4194 inject_emulated_exception(vcpu); 4192 inject_emulated_exception(vcpu);
4195 else if (vcpu->arch.pio.count) { 4193 r = EMULATE_DONE;
4194 } else if (vcpu->arch.pio.count) {
4196 if (!vcpu->arch.pio.in) 4195 if (!vcpu->arch.pio.in)
4197 vcpu->arch.pio.count = 0; 4196 vcpu->arch.pio.count = 0;
4198 r = EMULATE_DO_MMIO; 4197 r = EMULATE_DO_MMIO;
@@ -4200,8 +4199,10 @@ restart:
4200 if (vcpu->mmio_is_write) 4199 if (vcpu->mmio_is_write)
4201 vcpu->mmio_needed = 0; 4200 vcpu->mmio_needed = 0;
4202 r = EMULATE_DO_MMIO; 4201 r = EMULATE_DO_MMIO;
4203 } else if (vcpu->arch.emulate_ctxt.restart) 4202 } else if (r == EMULATION_RESTART)
4204 goto restart; 4203 goto restart;
4204 else
4205 r = EMULATE_DONE;
4205 4206
4206 toggle_interruptibility(vcpu, vcpu->arch.emulate_ctxt.interruptibility); 4207 toggle_interruptibility(vcpu, vcpu->arch.emulate_ctxt.interruptibility);
4207 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); 4208 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
@@ -5100,8 +5101,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
5100 if (!irqchip_in_kernel(vcpu->kvm)) 5101 if (!irqchip_in_kernel(vcpu->kvm))
5101 kvm_set_cr8(vcpu, kvm_run->cr8); 5102 kvm_set_cr8(vcpu, kvm_run->cr8);
5102 5103
5103 if (vcpu->arch.pio.count || vcpu->mmio_needed || 5104 if (vcpu->arch.pio.count || vcpu->mmio_needed) {
5104 vcpu->arch.emulate_ctxt.restart) {
5105 if (vcpu->mmio_needed) { 5105 if (vcpu->mmio_needed) {
5106 memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); 5106 memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8);
5107 vcpu->mmio_read_completed = 1; 5107 vcpu->mmio_read_completed = 1;