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:53:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 06/27/2016 02:48 PM, Peter Maydell wrote:
On 27 June 2016 at 22:43, Richard Henderson <address@hidden> wrote:
All you need to do is byte-reverse the data.

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

?

0xFF + 0xFF == 0x1FE, bswap(0x1FE) == 0xFE010000
bswap(0xFF) + bswap(0xFF) == 0xFF000000 + 0xFF000000 == 0x1FE000000
(or 0xFE000000 with truncate to 32-bit).

Or am I missing something?

No, you're quite right.  I think I didn't have enough coffee this morning.

So we'd need a cmpxchg loop for reverse-endian add.


r~




reply via email to

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