3 * \brief ARM specific implementation of atomic functions
6 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
7 * Alexander Warg <warg@os.inf.tu-dresden.de>
8 * economic rights: Technische Universität Dresden (Germany)
9 * This file is part of TUD:OS and distributed under the terms of the
10 * GNU Lesser General Public License 2.1.
11 * Please see the COPYING-LGPL-2.1 file for details.
13 #ifndef __L4UTIL__INCLUDE__ARCH_ARM__ATOMIC_ARCH_H__
14 #define __L4UTIL__INCLUDE__ARCH_ARM__ATOMIC_ARCH_H__
18 #include <l4/sys/kdebug.h>
22 #define __L4UTIL_ATOMIC_HAVE_ARCH_CMPXCHG32
24 l4util_cmpxchg32(volatile l4_uint32_t * dest,
25 l4_uint32_t cmp_val, l4_uint32_t new_val)
27 return l4_atomic_cmpxchg((volatile long int *)dest, cmp_val, new_val);
30 #define __L4UTIL_ATOMIC_HAVE_ARCH_CMPXCHG
32 l4util_cmpxchg(volatile l4_umword_t * dest,
33 l4_umword_t cmp_val, l4_umword_t new_val)
35 return l4_atomic_cmpxchg((volatile long int *)dest, cmp_val, new_val);
38 #define __L4UTIL_ATOMIC_HAVE_ARCH_XCHG32
40 l4util_xchg32(volatile l4_uint32_t *dest, l4_uint32_t new_val)
42 return l4_atomic_xchg((volatile long int *)dest, new_val);
45 #define __L4UTIL_ATOMIC_HAVE_ARCH_XCHG
47 l4util_xchg(volatile l4_umword_t *dest, l4_umword_t new_val)
49 return l4_atomic_xchg((volatile long int *)dest, new_val);
52 #define __L4UTIL_ATOMIC_HAVE_ARCH_ADD
54 l4util_atomic_add(volatile long *dest, long val)
56 l4_atomic_add(dest, val);
59 #define __L4UTIL_ATOMIC_HAVE_ARCH_INC
61 l4util_atomic_inc(volatile long *dest)
63 l4_atomic_add(dest, 1);
67 l4util_inc32(volatile l4_uint32_t *dest)
69 l4_atomic_add((volatile long int *)dest, 1);
73 l4util_dec32(volatile l4_uint32_t *dest)
75 l4_atomic_add((volatile long int *)dest, -1);
80 l4util_inc32_res(volatile l4_uint32_t *dest)
82 return l4_atomic_add((volatile long int *)dest, 1);
86 l4util_dec32_res(volatile l4_uint32_t *dest)
88 return l4_atomic_add((volatile long int *)dest, -1);
95 #endif /* ! __L4UTIL__INCLUDE__ARCH_ARM__ATOMIC_ARCH_H__ */