aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 2d55bab41634..888b0924c17b 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1251,7 +1251,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
1251 u16 error_code, 1251 u16 error_code,
1252 int no_decode) 1252 int no_decode)
1253{ 1253{
1254 int r = 0; 1254 int r;
1255 1255
1256 vcpu->mmio_fault_cr2 = cr2; 1256 vcpu->mmio_fault_cr2 = cr2;
1257 kvm_x86_ops->cache_regs(vcpu); 1257 kvm_x86_ops->cache_regs(vcpu);
@@ -1294,10 +1294,14 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
1294 get_segment_base(vcpu, VCPU_SREG_FS); 1294 get_segment_base(vcpu, VCPU_SREG_FS);
1295 1295
1296 r = x86_decode_insn(&vcpu->emulate_ctxt, &emulate_ops); 1296 r = x86_decode_insn(&vcpu->emulate_ctxt, &emulate_ops);
1297 if (r) {
1298 if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
1299 return EMULATE_DONE;
1300 return EMULATE_FAIL;
1301 }
1297 } 1302 }
1298 1303
1299 if (r == 0) 1304 r = x86_emulate_insn(&vcpu->emulate_ctxt, &emulate_ops);
1300 r = x86_emulate_insn(&vcpu->emulate_ctxt, &emulate_ops);
1301 1305
1302 if (vcpu->pio.string) 1306 if (vcpu->pio.string)
1303 return EMULATE_DO_MMIO; 1307 return EMULATE_DO_MMIO;