From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0bJL-0001LV-Vj for qemu-devel@nongnu.org; Wed, 11 May 2016 17:04:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0bJH-0002Or-NX for qemu-devel@nongnu.org; Wed, 11 May 2016 17:04:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0bJH-0002Oi-H6 for qemu-devel@nongnu.org; Wed, 11 May 2016 17:04:47 -0400 Date: Wed, 11 May 2016 22:04:45 +0100 From: "Richard W.M. Jones" Message-ID: <20160511210444.GG1683@redhat.com> References: <1462988574-30590-1-git-send-email-rjones@redhat.com> <1462988574-30590-3-git-send-email-rjones@redhat.com> <573390FF.8010409@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <573390FF.8010409@redhat.com> Subject: Re: [Qemu-devel] [PATCH v7 2/2] Add optionrom compatible with fw_cfg DMA version List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@gmail.com, marc.mari.barcelo@gmail.com, ehabkost@redhat.com, mst@redhat.com, kraxel@redhat.com, rth@twiddle.net, lersek@redhat.com On Wed, May 11, 2016 at 10:07:27PM +0200, Paolo Bonzini wrote: > > > On 11/05/2016 19:42, Richard W.M. Jones wrote: > > + > > +#ifdef __clang__ > > +#define ADDR32 > > +#else > > +#define ADDR32 "addr32 " > > +#endif > > + > > +static inline uint16_t readw_es(uint16_t offset) > > +{ > > + uint16_t val; > > + asm(ADDR32"movw %%es:(%1), %0" : "=r"(val) : "r"((uint32_t)offset)); > > + barrier(); > > + return val; > > +} > > Please check that the output is the same byte-by-byte for this asm. For this function, clang emits: 647: 26 67 8b 08 mov %es:(%eax),%cx GCC emits: b3: 26 67 8b 00 mov %es:(%eax),%ax So yes these are byte for byte identical (except for the MOD R/M byte because of the different target register). > I guess this is okay if we have a guarantee from clang that the asm > block stays at the beginning. Perhaps check for the 0x55 0xaa signature > in signrom.py? Good idea, I'll add this in the next version. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top