From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] (big) real mode emulation - or instruction correction Date: Sat, 15 Sep 2007 10:33:35 +0300 Message-ID: <46EB8ACF.1030705@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> 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: <1189725983.28738.15.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, > This patch corrects the emulation of the instruction "or" for opcodes > 0xc & 0cd. > Please Apply. > > + case 0x0c: /* or al imm8 */ > + dst.type = OP_REG; > + dst.ptr = &_regs[VCPU_REGS_RAX]; > + dst.val = *(u8 *)dst.ptr; > + dst.bytes = 1; > + dst.orig_val = dst.val; > + goto or; > + case 0x0d: /* or ax imm16, or eax imm32 */ > + dst.type = OP_REG; > + dst.bytes = op_bytes; > + dst.ptr = &_regs[VCPU_REGS_RAX]; > + if (op_bytes == 2) > + dst.val = *(u16 *)dst.ptr; > + else > + dst.val = *(u32 *)dst.ptr; > + dst.orig_val = dst.val; > + goto or; Instead of repeating this code for all instructions that use the accumulator implicitly, we should define a bit in the decoder flags (like DstAcc) so that all the code is consolidated in the decoder. This applies to 'sub imm' and 'cmp correction', and probably others as well. -- 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/