]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
arm64: klib: bitops: fix unpredictable stxr usage
authorMark Rutland <mark.rutland@arm.com>
Tue, 30 Apr 2013 10:11:15 +0000 (11:11 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 30 Apr 2013 14:53:01 +0000 (15:53 +0100)
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>
arch/arm64/lib/bitops.S

index fd1e801b53e7229c51b819beaf20c9e436e09f92..eaed8bbd78fc5e144e0e9fa6d0cba2a9d1ecf50b 100644 (file)
@@ -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