1 #ifndef __ASM_SH_BITOPS_LLSC_H
2 #define __ASM_SH_BITOPS_LLSC_H
4 static inline void set_bit(int nr
, volatile void *addr
)
7 volatile unsigned int *a
= addr
;
11 mask
= 1 << (nr
& 0x1f);
13 __asm__
__volatile__ (
15 "movli.l @%1, %0 ! set_bit \n\t"
17 "movco.l %0, @%1 \n\t"
25 static inline void clear_bit(int nr
, volatile void *addr
)
28 volatile unsigned int *a
= addr
;
32 mask
= 1 << (nr
& 0x1f);
34 __asm__
__volatile__ (
36 "movli.l @%1, %0 ! clear_bit \n\t"
38 "movco.l %0, @%1 \n\t"
41 : "r" (a
), "r" (~mask
)
46 static inline void change_bit(int nr
, volatile void *addr
)
49 volatile unsigned int *a
= addr
;
53 mask
= 1 << (nr
& 0x1f);
55 __asm__
__volatile__ (
57 "movli.l @%1, %0 ! change_bit \n\t"
59 "movco.l %0, @%1 \n\t"
67 static inline int test_and_set_bit(int nr
, volatile void *addr
)
70 volatile unsigned int *a
= addr
;
74 mask
= 1 << (nr
& 0x1f);
76 __asm__
__volatile__ (
78 "movli.l @%2, %0 ! test_and_set_bit \n\t"
81 "movco.l %0, @%2 \n\t"
84 : "=&z" (tmp
), "=&r" (retval
)
92 static inline int test_and_clear_bit(int nr
, volatile void *addr
)
95 volatile unsigned int *a
= addr
;
99 mask
= 1 << (nr
& 0x1f);
101 __asm__
__volatile__ (
103 "movli.l @%2, %0 ! test_and_clear_bit \n\t"
106 "movco.l %0, @%2 \n\t"
110 : "=&z" (tmp
), "=&r" (retval
)
111 : "r" (a
), "r" (mask
), "r" (~mask
)
118 static inline int test_and_change_bit(int nr
, volatile void *addr
)
121 volatile unsigned int *a
= addr
;
125 mask
= 1 << (nr
& 0x1f);
127 __asm__
__volatile__ (
129 "movli.l @%2, %0 ! test_and_change_bit \n\t"
132 "movco.l %0, @%2 \n\t"
136 : "=&z" (tmp
), "=&r" (retval
)
137 : "r" (a
), "r" (mask
)
144 #include <asm-generic/bitops/non-atomic.h>
146 #endif /* __ASM_SH_BITOPS_LLSC_H */