From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Vivier Subject: [PATCH 4/5][RESEND] emulate_instruction() calls now x86_decode_insn() and x86_emulate_insn() Date: Tue, 18 Sep 2007 11:27:27 +0200 Message-ID: <46EF99FF.5060309@bull.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040301070501030202090309" To: kvm-devel Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is a multi-part message in MIME format. --------------040301070501030202090309 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 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 --------------040301070501030202090309 Content-Transfer-Encoding: 7bit Content-Type: text/plain; name="x86_emulate-split" Content-Disposition: inline; filename="x86_emulate-split" Index: kvm/drivers/kvm/kvm_main.c =================================================================== --- kvm.orig/drivers/kvm/kvm_main.c 2007-09-18 09:45:19.000000000 +0200 +++ kvm/drivers/kvm/kvm_main.c 2007-09-18 10:40:45.000000000 +0200 @@ -1287,7 +1287,10 @@ int emulate_instruction(struct kvm_vcpu vcpu->mmio_is_write = 0; vcpu->pio.string = 0; - r = x86_emulate_memop(&emulate_ctxt, &emulate_ops); + r = x86_decode_insn(&emulate_ctxt, &emulate_ops); + if (r == 0) + 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-09-18 10:40:37.000000000 +0200 +++ kvm/drivers/kvm/x86_emulate.c 2007-09-18 10:40:45.000000000 +0200 @@ -911,18 +911,14 @@ done: } 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) { unsigned long cr2 = ctxt->cr2; int no_wb = 0; u64 msr_data; unsigned long _eflags = ctxt->eflags; struct decode_cache *decode = &ctxt->decode; - int rc; - - rc = x86_decode_insn(ctxt, ops); - if (rc) - return rc; + int rc = 0; if (decode->src.type == OP_MEM) { decode->src.ptr = (unsigned long *)ctxt->cr2; Index: kvm/drivers/kvm/x86_emulate.h =================================================================== --- kvm.orig/drivers/kvm/x86_emulate.h 2007-09-18 10:06:02.000000000 +0200 +++ kvm/drivers/kvm/x86_emulate.h 2007-09-18 10:40:45.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, - struct x86_emulate_ops *ops); +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__ */ --------------040301070501030202090309 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ --------------040301070501030202090309 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------040301070501030202090309--