From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] (big) real mode emulation - initialization fixes Date: Fri, 14 Sep 2007 20:08:47 +0300 Message-ID: <46EAC01F.7040609@qumranet.com> References: <1188349132.9270.7.camel@lnitindesktop.sc.intel.com> <46E79B2A.60506@qumranet.com> <46E7A073.6030601@bull.net> <46E7A317.208@qumranet.com> <47DF6B76DC88174EB18F2393E76FC46EB20712F4@scsmsx412.amr.corp.intel.com> <1189707324.28738.0.camel@lnitindesktop.sc.intel.com> <1189709705.28738.9.camel@lnitindesktop.sc.intel.com> <1189725509.28738.12.camel@lnitindesktop.sc.intel.com> <1189725983.28738.15.camel@lnitindesktop.sc.intel.com> <1189726560.28738.18.camel@lnitindesktop.sc.intel.com> <1189727241.28738.21.camel@lnitindesktop.sc.intel.com> <1189727640.28738.24.camel@lnitindesktop.sc.intel.com> <1189728138.28738.27.camel@lnitindesktop.sc.intel.com> <1189728902.28738.31.camel@lnitindesktop.sc.intel.com> <1189729357.28738.33.camel@lnitindesktop.sc.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , Laurent Vivier To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org Return-path: In-Reply-To: <1189729357.28738.33.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org> 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 Nitin A Kamble wrote: > Hi Avi, > Attached is the patch to initialize src.val & dst.val. Without this, > certain instructions are getting affected in their emulation. > > Please apply. > > This seems like it is papering over other bugs. Some instructions use src.val or dst.val without having decoded the src or dst operand. Which instructions are these? Can we fix them instead? > Intialize src.val & dst.val, to fix bugs in certain instruction emulations. > > Signed-off-by: Nitin A Kamble > > diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c > index c2540c3..90ee392 100644 > --- a/drivers/kvm/x86_emulate.c > +++ b/drivers/kvm/x86_emulate.c > @@ -832,6 +832,7 @@ done_prefixes: > srcmem_common: > src.type = OP_MEM; > src.ptr = (unsigned long *)cr2; > + src.val = 0; > if ((rc = ops->read_emulated((unsigned long)src.ptr, > &src.val, src.bytes, ctxt->vcpu)) != 0) > goto done; > @@ -896,6 +897,7 @@ done_prefixes: > dst.type = OP_MEM; > dst.ptr = (unsigned long *)cr2; > dst.bytes = (d & ByteOp) ? 1 : op_bytes; > + dst.val = 0; > if (d & BitOp) { > unsigned long mask = ~(dst.bytes * 8 - 1); > > -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- 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/