diff mbox

[3/3] Reenter guest after instruction emulation failure if emulation was due to access to non-mmio address.

Message ID 1278523006-21645-3-git-send-email-gleb@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gleb Natapov July 7, 2010, 5:16 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7070b41..dd7b241 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4000,6 +4000,8 @@  int emulate_instruction(struct kvm_vcpu *vcpu,
 		if (r)  {
 			if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
 				return EMULATE_DONE;
+			if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, cr2)))
+				return EMULATE_DONE;
 			if (emulation_type & EMULTYPE_SKIP)
 				return EMULATE_FAIL;
 			return handle_emulation_failure(vcpu);
@@ -4026,6 +4028,8 @@  restart:
 		 */
 		if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
 			return EMULATE_DONE;
+		if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, cr2)))
+			return EMULATE_DONE;
 
 		return handle_emulation_failure(vcpu);
 	}