summaryrefslogtreecommitdiff
path: root/intel
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2010-01-16 19:28:50 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2010-01-16 19:37:06 -0800
commitb1ce1e6bfbb65cca3230762cf99d4c0775561781 (patch)
tree701944f60f771576778e5967ca861e173a5de42e /intel
parentfe7b93fb493b76ade13ad74438acbc4d34d2f3bd (diff)
Add support for Solaris libc atomic operations
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Diffstat (limited to 'intel')
-rw-r--r--intel/intel_atomic.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/intel/intel_atomic.h b/intel/intel_atomic.h
index e725c4a4..12bb96bc 100644
--- a/intel/intel_atomic.h
+++ b/intel/intel_atomic.h
@@ -71,6 +71,21 @@ typedef struct {
#endif
+#if defined(__sun) && !defined(HAS_ATOMIC_OPS) /* Solaris & OpenSolaris */
+
+#include <sys/atomic.h>
+#define HAS_ATOMIC_OPS 1
+
+typedef struct { uint_t atomic; } atomic_t;
+
+# define atomic_read(x) (int) ((x)->atomic)
+# define atomic_set(x, val) ((x)->atomic = (uint_t)(val))
+# define atomic_inc(x) (atomic_inc_uint (&(x)->atomic))
+# define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 1)
+# define atomic_cmpxchg(x, oldv, newv) atomic_cas_uint (&(x)->atomic, oldv, newv)
+
+#endif
+
#if ! HAS_ATOMIC_OPS
#error libdrm-intel requires atomic operations, please define them for your CPU/compiler.
#endif