3 * \brief ARM specific implementation of atomic functions
6 * (c) 2008-2009 Technische Universität Dresden
7 * This file is part of TUD:OS and distributed under the terms of the
8 * GNU Lesser General Public License 2.1.
9 * Please see the COPYING-LGPL-2.1 file for details.
11 #ifndef __L4UTIL__INCLUDE__ARCH_ARM__ATOMIC_ARCH_H__
12 #define __L4UTIL__INCLUDE__ARCH_ARM__ATOMIC_ARCH_H__
16 #include <l4/sys/kdebug.h>
20 #define __L4UTIL_ATOMIC_HAVE_ARCH_CMPXCHG32
22 l4util_cmpxchg32(volatile l4_uint32_t * dest,
23 l4_uint32_t cmp_val, l4_uint32_t new_val)
25 return l4_atomic_cmpxchg((volatile long int *)dest, cmp_val, new_val);
28 #define __L4UTIL_ATOMIC_HAVE_ARCH_CMPXCHG
30 l4util_cmpxchg(volatile l4_umword_t * dest,
31 l4_umword_t cmp_val, l4_umword_t new_val)
33 return l4_atomic_cmpxchg((volatile long int *)dest, cmp_val, new_val);
36 #define __L4UTIL_ATOMIC_HAVE_ARCH_ADD
38 l4util_atomic_add(volatile long *dest, long val)
40 l4_atomic_add(dest, val);
43 #define __L4UTIL_ATOMIC_HAVE_ARCH_INC
45 l4util_atomic_inc(volatile long *dest)
47 l4_atomic_add(dest, 1);
51 l4util_inc32(volatile l4_uint32_t *dest)
53 l4_atomic_add((volatile long int *)dest, 1);
57 l4util_dec32(volatile l4_uint32_t *dest)
59 l4_atomic_add((volatile long int *)dest, -1);
64 l4util_inc32_res(volatile l4_uint32_t *dest)
66 return l4_atomic_add((volatile long int *)dest, 1);
70 l4util_dec32_res(volatile l4_uint32_t *dest)
72 return l4_atomic_add((volatile long int *)dest, -1);
79 #endif /* ! __L4UTIL__INCLUDE__ARCH_ARM__ATOMIC_ARCH_H__ */