Lines Matching defs:ptr
89 #define qatomic_read__nocheck(ptr) \
90 __atomic_load_n(ptr, __ATOMIC_RELAXED)
92 #define qatomic_read(ptr) \
94 qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
95 qatomic_read__nocheck(ptr); \
98 #define qatomic_set__nocheck(ptr, i) \
99 __atomic_store_n(ptr, i, __ATOMIC_RELAXED)
101 #define qatomic_set(ptr, i) do { \
102 qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
103 qatomic_set__nocheck(ptr, i); \
110 #define qatomic_rcu_read__nocheck(ptr, valptr) \
111 __atomic_load(ptr, valptr, __ATOMIC_CONSUME);
113 #define qatomic_rcu_read__nocheck(ptr, valptr) \
114 __atomic_load(ptr, valptr, __ATOMIC_RELAXED); \
123 #define qatomic_rcu_read_internal(ptr, _val) \
125 qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
126 typeof_strip_qual(*ptr) _val; \
127 qatomic_rcu_read__nocheck(ptr, &_val); \
130 #define qatomic_rcu_read(ptr) \
131 qatomic_rcu_read_internal((ptr), MAKE_IDENTIFIER(_val))
133 #define qatomic_rcu_set(ptr, i) do { \
134 qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
135 __atomic_store_n(ptr, i, __ATOMIC_RELEASE); \
138 #define qatomic_load_acquire(ptr) \
140 qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
141 typeof_strip_qual(*ptr) _val; \
142 __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE); \
146 #define qatomic_store_release(ptr, i) do { \
147 qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
148 __atomic_store_n(ptr, i, __ATOMIC_RELEASE); \
154 #define qatomic_xchg__nocheck(ptr, i) ({ \
155 __atomic_exchange_n(ptr, (i), __ATOMIC_SEQ_CST); \
158 #define qatomic_xchg(ptr, i) ({ \
159 qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
160 qatomic_xchg__nocheck(ptr, i); \
163 /* Returns the old value of '*ptr' (whether the cmpxchg failed or not) */
164 #define qatomic_cmpxchg__nocheck(ptr, old, new) ({ \
165 typeof_strip_qual(*ptr) _old = (old); \
166 (void)__atomic_compare_exchange_n(ptr, &_old, new, false, \
171 #define qatomic_cmpxchg(ptr, old, new) ({ \
172 qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
173 qatomic_cmpxchg__nocheck(ptr, old, new); \
177 #define qatomic_fetch_inc(ptr) __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST)
178 #define qatomic_fetch_dec(ptr) __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST)
180 #define qatomic_fetch_add(ptr, n) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST)
181 #define qatomic_fetch_sub(ptr, n) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST)
182 #define qatomic_fetch_and(ptr, n) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST)
183 #define qatomic_fetch_or(ptr, n) __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST)
184 #define qatomic_fetch_xor(ptr, n) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST)
186 #define qatomic_inc_fetch(ptr) __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
187 #define qatomic_dec_fetch(ptr) __atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
188 #define qatomic_add_fetch(ptr, n) __atomic_add_fetch(ptr, n, __ATOMIC_SEQ_CST)
189 #define qatomic_sub_fetch(ptr, n) __atomic_sub_fetch(ptr, n, __ATOMIC_SEQ_CST)
190 #define qatomic_and_fetch(ptr, n) __atomic_and_fetch(ptr, n, __ATOMIC_SEQ_CST)
191 #define qatomic_or_fetch(ptr, n) __atomic_or_fetch(ptr, n, __ATOMIC_SEQ_CST)
192 #define qatomic_xor_fetch(ptr, n) __atomic_xor_fetch(ptr, n, __ATOMIC_SEQ_CST)
195 #define qatomic_inc(ptr) \
196 ((void) __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST))
197 #define qatomic_dec(ptr) \
198 ((void) __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST))
199 #define qatomic_add(ptr, n) \
200 ((void) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST))
201 #define qatomic_sub(ptr, n) \
202 ((void) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST))
203 #define qatomic_and(ptr, n) \
204 ((void) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST))
205 #define qatomic_or(ptr, n) \
206 ((void) __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST))
207 #define qatomic_xor(ptr, n) \
208 ((void) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST))
234 # define qatomic_set_mb(ptr, i) \
235 ({ (void)qatomic_xchg(ptr, i); smp_mb__after_rmw(); })
237 # define qatomic_set_mb(ptr, i) \
238 ({ qatomic_store_release(ptr, i); smp_mb(); })
241 #define qatomic_fetch_inc_nonzero(ptr) ({ \
242 typeof_strip_qual(*ptr) _oldn = qatomic_read(ptr); \
243 while (_oldn && qatomic_cmpxchg(ptr, _oldn, _oldn + 1) != _oldn) { \
244 _oldn = qatomic_read(ptr); \
277 int64_t qatomic_read_i64(const int64_t *ptr);
278 uint64_t qatomic_read_u64(const uint64_t *ptr);
279 void qatomic_set_i64(int64_t *ptr, int64_t val);
280 void qatomic_set_u64(uint64_t *ptr, uint64_t val);