1 #include <asm/assembler.h>
2 #include <asm/unwind.h>
4 #if __LINUX_ARM_ARCH__ >= 6
5 .macro bitop
, name
, instr
9 strneb r1
, [ip
] @
assert word
-aligned
11 and r3
, r0
, #31 @ Get bit offset
13 add r1
, r1
, r0
, lsl
#2 @ Get word offset
14 #if __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
30 .macro testop
, name
, instr
, store
34 strneb r1
, [ip
] @
assert word
-aligned
36 and r3
, r0
, #31 @ Get bit offset
38 add r1
, r1
, r0
, lsl
#2 @ Get word offset
39 mov r3
, r2
, lsl r3 @ create mask
41 #if __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
47 ands r0
, r2
, r3 @ save old value of bit
48 \instr r2
, r2
, r3 @ toggle bit
60 .macro bitop
, name
, instr
64 strneb r1
, [ip
] @
assert word
-aligned
69 save_and_disable_irqs ip
70 ldr r2
, [r1
, r0
, lsl
#2]
72 str r2
, [r1
, r0
, lsl
#2]
80 * testop - implement a test_and_xxx_bit operation.
81 * @instr: operational instruction
82 * @store: store instruction
84 * Note: we can trivially conditionalise the store instruction
85 * to avoid dirtying the data cache.
87 .macro testop
, name
, instr
, store
91 strneb r1
, [ip
] @
assert word
-aligned
94 save_and_disable_irqs ip
95 ldr r2
, [r1
, r0
, lsl
#2]!
98 \instr r2
, r2
, r0
, lsl r3