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);
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~
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
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
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