qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 2/2] Add optionrom compatible with fw_cfg DMA


From: Richard W.M. Jones
Subject: Re: [Qemu-devel] [PATCH v7 2/2] Add optionrom compatible with fw_cfg DMA version
Date: Wed, 11 May 2016 22:04:45 +0100
User-agent: Mutt/1.5.20 (2009-12-10)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]