3 * \brief SPARC 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_SPARC__ATOMIC_ARCH_H__
14 #define __L4UTIL__INCLUDE__ARCH_SPARC__ATOMIC_ARCH_H__
18 #include <l4/sys/atomic.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);
43 asm volatile ("ta 0");
47 #define __L4UTIL_ATOMIC_HAVE_ARCH_XCHG
49 l4util_xchg(volatile l4_umword_t *dest, l4_umword_t new_val)
51 // return l4_atomic_xchg((volatile long int *)dest, new_val);
52 asm volatile ("ta 0");
56 #define __L4UTIL_ATOMIC_HAVE_ARCH_ADD
58 l4util_atomic_add(volatile long *dest, long val)
60 l4_atomic_add(dest, val);
63 #define __L4UTIL_ATOMIC_HAVE_ARCH_INC
65 l4util_atomic_inc(volatile long *dest)
67 l4_atomic_add(dest, 1);
70 #define __L4UTIL_ATOMIC_HAVE_ARCH_INC32
72 l4util_inc32(volatile l4_uint32_t *dest)
74 l4_atomic_add((volatile long int *)dest, 1);
77 #define __L4UTIL_ATOMIC_HAVE_ARCH_DEC32
79 l4util_dec32(volatile l4_uint32_t *dest)
81 l4_atomic_add((volatile long int *)dest, -1);
85 #define __L4UTIL_ATOMIC_HAVE_ARCH_INC32_RES
87 l4util_inc32_res(volatile l4_uint32_t *dest)
89 return l4_atomic_add((volatile long int *)dest, 1);
92 #define __L4UTIL_ATOMIC_HAVE_ARCH_DEC32_RES
94 l4util_dec32_res(volatile l4_uint32_t *dest)
96 return l4_atomic_add((volatile long int *)dest, -1);
103 #endif /* ! __L4UTIL__INCLUDE__ARCH_SPARC__ATOMIC_ARCH_H__ */