aarch64: Implement caa_cpu_relax as yield instruction
[userspace-rcu.git] / include / urcu / uatomic / arm.h
CommitLineData
6aca0125
JW
1#ifndef _URCU_ARCH_UATOMIC_ARM_H
2#define _URCU_ARCH_UATOMIC_ARM_H
fdbddd0b 3
67ecffc0 4/*
6aca0125 5 * Atomics for ARM. This approach is usable on kernels back to 2.6.15.
fdbddd0b
PM
6 *
7 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
8 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
9 * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
10 * Copyright (c) 2009 Mathieu Desnoyers
11 * Copyright (c) 2010 Paul E. McKenney, IBM Corporation
12 * (Adapted from uatomic_arch_ppc.h)
13 *
14 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
15 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
16 *
17 * Permission is hereby granted to use or copy this program
18 * for any purpose, provided the above notices are retained on all copies.
19 * Permission to modify the code and to distribute modified code is granted,
20 * provided the above notices are retained, and a notice that the code was
21 * modified is included with the above copyright notice.
22 *
23 * Code inspired from libuatomic_ops-1.2, inherited in part from the
24 * Boehm-Demers-Weiser conservative garbage collector.
25 */
26
27#include <urcu/compiler.h>
28#include <urcu/system.h>
c278ffc7 29#include <urcu/arch.h>
fdbddd0b
PM
30
31#ifdef __cplusplus
32extern "C" {
67ecffc0 33#endif
fdbddd0b
PM
34
35/* xchg */
c278ffc7
MD
36
37/*
38 * Based on [1], __sync_lock_test_and_set() is not a full barrier, but
39 * instead only an acquire barrier. Given that uatomic_xchg() acts as
40 * both release and acquire barriers, we therefore need to have our own
41 * release barrier before this operation.
42 *
43 * [1] https://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
44 */
45#define uatomic_xchg(addr, v) \
46 ({ \
47 cmm_smp_mb(); \
48 __sync_lock_test_and_set(addr, v); \
49 })
fdbddd0b 50
67ecffc0 51#ifdef __cplusplus
fdbddd0b
PM
52}
53#endif
54
a2e7bf9c 55#include <urcu/uatomic/generic.h>
fdbddd0b 56
6aca0125 57#endif /* _URCU_ARCH_UATOMIC_ARM_H */
This page took 0.048543 seconds and 4 git commands to generate.