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

2023-07-28 Thread Helge Deller
On 7/28/23 17:35, Richard Henderson wrote: On 7/27/23 21:54, Helge Deller wrote: @@ -174,6 +175,10 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env)   return;   } +    /* endianess-swap if emulating armeb */ +    oldval = tswap32(oldval); +    newval = tswap32(newval);

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

2023-07-28 Thread Richard Henderson
On 7/27/23 21:54, Helge Deller wrote: @@ -174,6 +175,10 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env) return; } +/* endianess-swap if emulating armeb */ +oldval = tswap32(oldval); +newval = tswap32(newval); Must be tswap64. r~

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

2023-07-28 Thread Markus F.X.J. Oberhumer
Nitpick: the bug was introduced between 6.2.0 and 7.0.0, so "qemu >= v7.0.0" ~Markus On 2023-07-28 06:54, 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 mi

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

2023-07-28 Thread Markus F.X.J. Oberhumer
The fix in arm_kernel_cmpxchg64_helper probably should use tswap64() instead of tswap32(). ~Markus On 2023-07-28 06:54, 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 > c

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

2023-07-27 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