qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 01/30] softmmu: add cmpxchg helpers


From: Richard Henderson
Subject: Re: [Qemu-devel] [RFC 01/30] softmmu: add cmpxchg helpers
Date: Mon, 27 Jun 2016 14:43:26 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 06/27/2016 02:19 PM, Emilio G. Cota wrote:
Host endian operation?

I forgot to add byte ordering in the cover letter under "why this is
an RFC" -- I admit I'm confused by all the macro trickery done for
regular loads and stores.

We store data in memory as per the guests' byte ordering, right?

Sometimes. The guest can also explicitly request a reversed byte load/store. This is used both for explicit byte-reversing instructions (e.g. x86 movbe) and toggling the system byte order (arm setbe).


If so, I don't see how it would be possible to leverage the
host compiler for things like atomic_add -- we'd increment garbage,
not a meaningful value.

All you need to do is byte-reverse the data.

  bswap(a + b) == bswap(a) + bswap(b).


r~



reply via email to

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