Skip to content

Commit

Permalink
arm64: klib: bitops: fix unpredictable stxr usage
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Rutland authored and Catalin Marinas committed Apr 30, 2013
1 parent 1ae90e7 commit c47d6a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arm64/lib/bitops.S
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ ENTRY( \name )
1: ldxr x2, [x1]
lsr x0, x2, x3 // Save old value of bit
\instr x2, x2, x4 // toggle bit
stxr w2, x2, [x1]
cbnz w2, 1b
stxr w5, x2, [x1]
cbnz w5, 1b
smp_dmb ish
and x0, x0, #1
3: ret
Expand Down

0 comments on commit c47d6a0

Please sign in to comment.