Skip to content

Commit c47d6a0

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: klib: bitops: fix unpredictable stxr usage
We're currently relying on unpredictable behaviour in our testops (test_and_*_bit), as stxr is unpredictable when the status register and the source register are the same This patch changes reallocates the status register so as to bring us back into the realm of predictable behaviour. Boot tested on an AEMv8 model. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 1ae90e7 commit c47d6a0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎arch/arm64/lib/bitops.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ ENTRY( \name )
5050
1: ldxr x2, [x1]
5151
lsr x0, x2, x3 // Save old value of bit
5252
\instr x2, x2, x4 // toggle bit
53-
stxr w2, x2, [x1]
54-
cbnz w2, 1b
53+
stxr w5, x2, [x1]
54+
cbnz w5, 1b
5555
smp_dmb ish
5656
and x0, x0, #1
5757
3: ret

0 commit comments

Comments
 (0)