uatomic/x86: Remove redundant memory barriers
[urcu.git] / include / urcu / uatomic / arm.h
1 // SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation. All rights reserved.
2 // SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics. All rights reserved.
3 // SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
4 // SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 // SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation
6 //
7 // SPDX-License-Identifier: LicenseRef-Boehm-GC
8
9 #ifndef _URCU_ARCH_UATOMIC_ARM_H
10 #define _URCU_ARCH_UATOMIC_ARM_H
11
12 /*
13 * Atomics for ARM. This approach is usable on kernels back to 2.6.15.
14 *
15 * Code inspired from libuatomic_ops-1.2, inherited in part from the
16 * Boehm-Demers-Weiser conservative garbage collector.
17 */
18
19 #include <urcu/compiler.h>
20 #include <urcu/system.h>
21 #include <urcu/arch.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /* xchg */
28
29 /*
30 * Based on [1], __sync_lock_test_and_set() is not a full barrier, but
31 * instead only an acquire barrier. Given that uatomic_xchg() acts as
32 * both release and acquire barriers, we therefore need to have our own
33 * release barrier before this operation.
34 *
35 * [1] https://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
36 */
37 #define uatomic_xchg(addr, v) \
38 ({ \
39 cmm_smp_mb(); \
40 __sync_lock_test_and_set(addr, v); \
41 })
42
43 #ifdef __cplusplus
44 }
45 #endif
46
47 #include <urcu/uatomic/generic.h>
48
49 #endif /* _URCU_ARCH_UATOMIC_ARM_H */
This page took 0.031464 seconds and 5 git commands to generate.