public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
To: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: [PATCH 4/5] emulate_instruction() calls now x86_decode_insn() and x86_emulate_insn()
Date: Wed, 29 Aug 2007 18:44:28 +0200	[thread overview]
Message-ID: <46D5A26C.2050904@bull.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

emulate_instruction() calls now x86_decode_insn() and x86_emulate_insn().
x86_emulate_insn() is x86_emulate_memop() without the decoding part.

Signed-off-by: Laurent Vivier <Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>

[-- Attachment #2: x86_emulate-split --]
[-- Type: text/plain, Size: 2378 bytes --]

Index: kvm/drivers/kvm/kvm_main.c
===================================================================
--- kvm.orig/drivers/kvm/kvm_main.c	2007-08-29 17:23:53.000000000 +0200
+++ kvm/drivers/kvm/kvm_main.c	2007-08-29 17:52:11.000000000 +0200
@@ -1201,9 +1201,13 @@ int emulate_instruction(struct kvm_vcpu 
 	emulate_ctxt.gs_base = get_segment_base(vcpu, VCPU_SREG_GS);
 	emulate_ctxt.fs_base = get_segment_base(vcpu, VCPU_SREG_FS);
 
+	r = x86_decode_insn(&emulate_ctxt, &emulate_ops);
+	if (r)
+		return EMULATE_FAIL;
+
 	vcpu->mmio_is_write = 0;
 	vcpu->pio.string = 0;
-	r = x86_emulate_memop(&emulate_ctxt, &emulate_ops);
+	r = x86_emulate_insn(&emulate_ctxt, &emulate_ops);
 	if (vcpu->pio.string)
 		return EMULATE_DO_MMIO;
 
Index: kvm/drivers/kvm/x86_emulate.c
===================================================================
--- kvm.orig/drivers/kvm/x86_emulate.c	2007-08-29 17:51:59.000000000 +0200
+++ kvm/drivers/kvm/x86_emulate.c	2007-08-29 17:52:11.000000000 +0200
@@ -881,19 +881,15 @@ cannot_emulate:
 }
 
 int
-x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
+x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
 {
 	struct decode_cache *decode = &ctxt->decode;
-	int rc;
+	int rc = 0;
 	int mode = ctxt->mode;
 	int no_wb = 0;
 	u64 msr_data;
 	unsigned long _eflags = ctxt->eflags;
 
-	rc = x86_decode_insn(ctxt, ops);
-	if (rc)
-		return rc;
-
 	if (decode->src.type == OP_MEM) {
 		decode->src.ptr = (unsigned long *)ctxt->cr2;
 		if ((rc = ops->read_emulated((unsigned long)decode->src.ptr,
Index: kvm/drivers/kvm/x86_emulate.h
===================================================================
--- kvm.orig/drivers/kvm/x86_emulate.h	2007-08-29 17:43:59.000000000 +0200
+++ kvm/drivers/kvm/x86_emulate.h	2007-08-29 17:52:11.000000000 +0200
@@ -178,12 +178,9 @@ struct x86_emulate_ctxt {
 #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64
 #endif
 
-/*
- * x86_emulate_memop: Emulate an instruction that faulted attempting to
- *                    read/write a 'special' memory area.
- * Returns -1 on failure, 0 on success.
- */
-int x86_emulate_memop(struct x86_emulate_ctxt *ctxt,
+int x86_decode_insn(struct x86_emulate_ctxt *ctxt,
+		    struct x86_emulate_ops *ops);
+int x86_emulate_insn(struct x86_emulate_ctxt *ctxt,
 		      struct x86_emulate_ops *ops);
 
 #endif				/* __X86_EMULATE_H__ */

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

                 reply	other threads:[~2007-08-29 16:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=46D5A26C.2050904@bull.net \
    --to=laurent.vivier-6ktuutfb/bm@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox