Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-31 Thread Philippe Mathieu-Daudé
On 28/7/23 21:23, Helge Deller wrote: Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Helge Deller
On 7/28/23 22:57, Richard Henderson wrote: On 7/28/23 13:51, Richard Henderson wrote: On 7/28/23 12:23, Helge Deller wrote: +    /* endianess-swap if emulating armeb */ +    oldval = tswap64(oldval); +    newval = tswap64(newval); Oh btw, it's not about arm vs armeb, but guest vs host. This a

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Richard Henderson
On 7/28/23 12:23, Helge Deller wrote: Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Richard Henderson
On 7/28/23 13:51, Richard Henderson wrote: On 7/28/23 12:23, Helge Deller wrote: +    /* endianess-swap if emulating armeb */ +    oldval = tswap64(oldval); +    newval = tswap64(newval); Oh btw, it's not about arm vs armeb, but guest vs host. This also fixes armel on big-endian hosts. Anywa

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Richard Henderson
On 7/28/23 12:23, Helge Deller wrote: +/* endianess-swap if emulating armeb */ +oldval = tswap64(oldval); +newval = tswap64(newval); Oh btw, it's not about arm vs armeb, but guest vs host. This also fixes armel on big-endian hosts. r~

[PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Helge Deller
Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects words to be stored in big endian in the