diff options
Diffstat (limited to 'arch/arm/lib/bitops.h')
-rw-r--r-- | arch/arm/lib/bitops.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h index 2e787d40d599..28c7e4e1ef76 100644 --- a/arch/arm/lib/bitops.h +++ b/arch/arm/lib/bitops.h @@ -5,6 +5,13 @@ and r3, r0, #7 @ Get bit offset add r1, r1, r0, lsr #3 @ Get byte offset mov r3, r2, lsl r3 +#ifdef CONFIG_ARM_ERRATA_351422 + mrc p15, 0, r0, c0, c0, 5 + and r0, r0, #0xf + mov r0, r0, lsl #8 +3: subs r0, r0, #1 + bpl 3b +#endif 1: ldrexb r2, [r1] \instr r2, r2, r3 strexb r0, r2, [r1] @@ -13,18 +20,29 @@ mov pc, lr .endm - .macro testop, instr, store + .macro testop, instr, store, cond=al and r3, r0, #7 @ Get bit offset mov r2, #1 add r1, r1, r0, lsr #3 @ Get byte offset mov r3, r2, lsl r3 @ create mask +#ifdef CONFIG_ARM_ERRATA_351422 + mrc p15, 0, r0, c0, c0, 5 + and r0, r0, #0xf + mov r0, r0, lsl #8 +3: subs r0, r0, #1 + bpl 3b +#endif 1: ldrexb r2, [r1] ands r0, r2, r3 @ save old value of bit - \instr r2, r2, r3 @ toggle bit + .ifnc \cond,al + it \cond + .endif + \instr r2, r2, r3 @ toggle bit strexb ip, r2, [r1] cmp ip, #0 bne 1b cmp r0, #0 + it ne movne r0, #1 2: mov pc, lr .endm @@ -49,7 +67,7 @@ * Note: we can trivially conditionalise the store instruction * to avoid dirtying the data cache. */ - .macro testop, instr, store + .macro testop, instr, store, cond=al add r1, r1, r0, lsr #3 and r3, r0, #7 mov r0, #1 |