All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
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
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	[thread overview]
Message-ID: <20160511210444.GG1683@redhat.com> (raw)
In-Reply-To: <573390FF.8010409@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

      reply	other threads:[~2016-05-11 21:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 17:42 [Qemu-devel] [PATCH v7 0/2] Add optionrom compatible with fw_cfg DMA version Richard W.M. Jones
2016-05-11 17:42 ` [Qemu-devel] [PATCH v7 1/2] scripts/signrom.py: Allow option ROM checksum script to write the size header Richard W.M. Jones
2016-05-11 17:42 ` [Qemu-devel] [PATCH v7 2/2] Add optionrom compatible with fw_cfg DMA version Richard W.M. Jones
2016-05-11 20:07   ` Paolo Bonzini
2016-05-11 21:04     ` Richard W.M. Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160511210444.GG1683@redhat.com \
    --to=rjones@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=marc.mari.barcelo@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.