Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143068343
D36015.id108904.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
978 B
Referenced Files
None
Subscribers
None
D36015.id108904.diff
View Options
Index: sys/compat/linuxkpi/common/include/asm/atomic.h
===================================================================
--- sys/compat/linuxkpi/common/include/asm/atomic.h
+++ sys/compat/linuxkpi/common/include/asm/atomic.h
@@ -268,6 +268,28 @@
__ret.val; \
})
+#define try_cmpxchg(p, op, n) \
+({ \
+ __typeof(p) __op = (__typeof((p)))(op); \
+ __typeof(*(p)) __o = *__op; \
+ __typeof(*(p)) __p = __sync_val_compare_and_swap((p), (__o), (n)); \
+ if (__p != __o) \
+ *__op = __p; \
+ (__p == __o); \
+})
+
+#define __atomic_try_cmpxchg(type, _p, _po, _n) \
+({ \
+ __typeof(_po) __po = (_po); \
+ __typeof(*(_po)) __r, __o = *__po; \
+ __r = atomic_cmpxchg##type((_p), __o, (_n)); \
+ if (unlikely(__r != __o)) \
+ *__po = __r; \
+ likely(__r == __o); \
+})
+
+#define atomic_try_cmpxchg(_p, _po, _n) __atomic_try_cmpxchg(, _p, _po, _n)
+
static inline int
atomic_dec_if_positive(atomic_t *v)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 26, 3:01 PM (21 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28038020
Default Alt Text
D36015.id108904.diff (978 B)
Attached To
Mode
D36015: linuxkpi: Add try_cmpxchg and atomic_try_cmpxchg
Attached
Detach File
Event Timeline
Log In to Comment