Update 386 cmpxchg support
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 8 Oct 2009 04:44:21 +0000 (00:44 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 8 Oct 2009 04:44:21 +0000 (00:44 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu-pointer-static.h
urcu/uatomic_arch_x86.h

index 33bfdeecae3351a4b339481eb253b342434ece76..c0533c9d3281af0f613e7490ce18e67594bf75e4 100644 (file)
                if (!__builtin_constant_p(_new) ||                      \
                    ((_new) != NULL))                                   \
                        wmb();                                          \
-               uatomic_cmpxchg(p, _________pold, _________pnew);       \
+               (likely(URCU_CAS_AVAIL()) ?                             \
+                       (uatomic_cmpxchg(p, _________pold, _________pnew)) : \
+                       (compat_uatomic_cmpxchg(p, _________pold,       \
+                                               _________pnew)))        \
        })
 
 /**
index fccea8e2d350321ebe9cbf4517a68866e4b5fa19..dfb58763a37259b88a8962f9bd607767d5c59a3a 100644 (file)
@@ -402,7 +402,13 @@ void _uatomic_dec(void *addr, int len)
 #define compat_uatomic_cmpxchg(ptr, old, _new) uatomic_cmpxchg(ptr, old, _new)
 #else
 extern int __urcu_cas_avail;
-#define URCU_CAS_AVAIL()       __urcu_cas_avail
+extern int __urcu_cas_init(void);
+#define URCU_CAS_AVAIL()                                               \
+               ((likely(__urcu_cas_avail > 0)) ?                       \
+                       (1) :                                           \
+                       ((unlikely(__urcu_cas_avail < 0) ?              \
+                               (__urcu_cas_init()) :                   \
+                               (0))))
 
 extern unsigned long _compat_uatomic_cmpxchg(void *addr, unsigned long old,
                              unsigned long _new, int len);
This page took 0.026438 seconds and 4 git commands to generate.