From: Mohammed Gamal <m.gamal005@gmail.com>
To: avi@redhat.com
Cc: mtosatti@redhat.com, kvm@vger.kernel.org,
Mohammed Gamal <m.gamal005@gmail.com>
Subject: [PATCH 2/2] x86: Bail out on unemulated instructions
Date: Sat, 14 Aug 2010 18:51:34 +0300 [thread overview]
Message-ID: <1281801094-4515-2-git-send-email-m.gamal005@gmail.com> (raw)
In-Reply-To: <1281801094-4515-1-git-send-email-m.gamal005@gmail.com>
If emulation fails due to the instruction being unemulated. Return immediately
instead of restarting the instruction and infinitely trying to execute it.
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
arch/x86/kvm/x86.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 416aa0e..a31db44 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4036,6 +4036,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
}
++vcpu->stat.insn_emulation;
+ if (r == X86EMUL_UNHANDLEABLE)
+ return handle_emulation_failure(vcpu);
+
if (r) {
if (reexecute_instruction(vcpu, cr2))
return EMULATE_DONE;
@@ -4057,6 +4060,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
restart:
r = x86_emulate_insn(&vcpu->arch.emulate_ctxt);
+ if (r == X86EMUL_UNHANDLEABLE)
+ return handle_emulation_failure(vcpu);
+
if (r) { /* emulation failed */
if (reexecute_instruction(vcpu, cr2))
return EMULATE_DONE;
--
1.7.0.4
next prev parent reply other threads:[~2010-08-14 15:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-14 15:51 [PATCH 1/2] x86 emulator: Fix emulator return values Mohammed Gamal
2010-08-14 15:51 ` Mohammed Gamal [this message]
2010-08-15 7:32 ` [PATCH 2/2] x86: Bail out on unemulated instructions Gleb Natapov
2010-08-15 12:40 ` Mohammed Gamal
2010-08-15 12:41 ` Gleb Natapov
2010-08-15 12:43 ` Mohammed Gamal
2010-08-15 12:49 ` Gleb Natapov
2010-08-15 15:58 ` Avi Kivity
2010-08-15 16:11 ` Gleb Natapov
2010-08-15 16:17 ` Avi Kivity
2010-08-15 15:40 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1281801094-4515-2-git-send-email-m.gamal005@gmail.com \
--to=m.gamal005@gmail.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox