Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109954639
D36015.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
971 B
Referenced Files
None
Subscribers
None
D36015.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/asm/atomic.h b/sys/compat/linuxkpi/common/include/asm/atomic.h
--- a/sys/compat/linuxkpi/common/include/asm/atomic.h
+++ b/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
Wed, Feb 12, 4:47 PM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16613214
Default Alt Text
D36015.diff (971 B)
Attached To
Mode
D36015: linuxkpi: Add try_cmpxchg and atomic_try_cmpxchg
Attached
Detach File
Event Timeline
Log In to Comment