1 #ifndef _URCU_ARCH_UATOMIC_SPARC64_H
2 #define _URCU_ARCH_UATOMIC_SPARC64_H
5 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
6 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
7 * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
8 * Copyright (c) 2009 Mathieu Desnoyers
10 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
11 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
13 * Permission is hereby granted to use or copy this program
14 * for any purpose, provided the above notices are retained on all copies.
15 * Permission to modify the code and to distribute modified code is granted,
16 * provided the above notices are retained, and a notice that the code was
17 * modified is included with the above copyright notice.
19 * Code inspired from libuatomic_ops-1.2, inherited in part from the
20 * Boehm-Demers-Weiser conservative garbage collector.
23 #include <urcu/compiler.h>
24 #include <urcu/system.h>
30 #ifndef __SIZEOF_LONG__
32 #define __SIZEOF_LONG__ 8
34 #define __SIZEOF_LONG__ 4
39 #define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
44 static inline __attribute__((always_inline
))
45 unsigned long _uatomic_cmpxchg(void *addr
, unsigned long old
,
46 unsigned long _new
, int len
)
51 __asm__
__volatile__ (
52 "membar #StoreLoad | #LoadLoad\n\t"
54 "membar #StoreLoad | #StoreStore\n\t"
56 : "r" (addr
), "r" (old
)
61 #if (BITS_PER_LONG == 64)
64 __asm__
__volatile__ (
65 "membar #StoreLoad | #LoadLoad\n\t"
67 "membar #StoreLoad | #StoreStore\n\t"
69 : "r" (addr
), "r" (old
)
81 #define uatomic_cmpxchg(addr, old, _new) \
82 ((__typeof__(*(addr))) _uatomic_cmpxchg((addr), (unsigned long)(old),\
83 (unsigned long)(_new), \
90 #include <urcu/uatomic_generic.h>
92 #endif /* _URCU_ARCH_UATOMIC_PPC_H */
This page took 0.032233 seconds and 4 git commands to generate.