From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] x86 emulator: Add 'push es' instruction (opcode 0x06) Date: Mon, 17 Aug 2009 11:03:00 +0300 Message-ID: <4A890EB4.3000603@redhat.com> References: <20090816175138.GA8521@mohd-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from mx2.redhat.com ([66.187.237.31]:58493 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757229AbZHQIDD (ORCPT ); Mon, 17 Aug 2009 04:03:03 -0400 In-Reply-To: <20090816175138.GA8521@mohd-laptop> Sender: kvm-owner@vger.kernel.org List-ID: On 08/16/2009 08:51 PM, Mohammed Gamal wrote: > > +static void emulate_push_sreg(struct x86_emulate_ctxt *ctxt, int seg) > +{ > + struct decode_cache *c =&ctxt->decode; > + struct kvm_segment segment; > + kvm_x86_ops->get_segment(ctxt->vcpu,&segment, seg); > + c->src.ptr = (unsigned long *)&segment.selector; > + emulate_push(ctxt); > +} > This will pick up random junk from segment.type if used in 32-bit mode, since segment.selector is only 16 bits wide. btw, I see that emulate_push() uses src.val, not src.ptr. Have you tested this? -- error compiling committee.c: too many arguments to function