All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH v2 09/10] Add new mode of instruction emulation: skip.
Date: Sun, 12 Apr 2009 10:26:38 +0300	[thread overview]
Message-ID: <20090412072638.5828.43761.stgit@trex.usersys.redhat.com> (raw)
In-Reply-To: <20090412072555.5828.46351.stgit@trex.usersys.redhat.com>

In the new mode instruction is decoded, but not executed. The EIP
is moved to point after the instruction.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/include/asm/kvm_host.h |    1 +
 arch/x86/kvm/x86.c              |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 3fc4623..e672ca5 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -565,6 +565,7 @@ enum emulation_result {
 
 #define EMULTYPE_NO_DECODE	    (1 << 0)
 #define EMULTYPE_TRAP_UD	    (1 << 1)
+#define EMULTYPE_SKIP		    (1 << 2)
 int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run,
 			unsigned long cr2, u16 error_code, int emulation_type);
 void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0bb4131..52c7a29 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2412,6 +2412,11 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
 		}
 	}
 
+	if (emulation_type & EMULTYPE_SKIP) {
+		kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.decode.eip);
+		return EMULATE_DONE;
+	}
+
 	r = x86_emulate_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
 
 	if (vcpu->arch.pio.string)


  parent reply	other threads:[~2009-04-12  7:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-12  7:25 [PATCH v2 01/10] Add decoding of 16bit second immediate argument Gleb Natapov
2009-04-12  7:26 ` [PATCH v2 02/10] Add lcall decoding Gleb Natapov
2009-04-12  7:26 ` [PATCH v2 03/10] Complete ljmp decoding at decode stage Gleb Natapov
2009-04-12  7:26 ` [PATCH v2 04/10] Complete short/near jcc decoding in " Gleb Natapov
2009-04-12  7:26 ` [PATCH v2 05/10] Complete decoding of call near " Gleb Natapov
2009-04-12  7:26 ` [PATCH v2 06/10] Add unsigned byte immediate decode Gleb Natapov
2009-04-12  7:26 ` [PATCH v2 07/10] Completely decode in/out at decoding stage Gleb Natapov
2009-04-12  7:26 ` [PATCH v2 08/10] Decode soft interrupt instructions Gleb Natapov
2009-04-12  7:26 ` Gleb Natapov [this message]
2009-04-12  7:26 ` [PATCH v2 10/10] [AMD] Skip instruction on a task switch only when appropriate Gleb Natapov

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=20090412072638.5828.43761.stgit@trex.usersys.redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.