2020-07-24 01:42:00 +00:00
|
|
|
diff --git a/nspr/pr/include/md/_linux.h b/nspr/pr/include/md/_linux.h
|
2022-12-28 15:39:25 +08:00
|
|
|
index ad57d08..57877b8 100644
|
2020-07-24 01:42:00 +00:00
|
|
|
--- a/nspr/pr/include/md/_linux.h
|
|
|
|
|
+++ b/nspr/pr/include/md/_linux.h
|
2022-12-28 15:39:25 +08:00
|
|
|
@@ -105,6 +105,15 @@
|
2020-07-24 01:42:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(__i386__)
|
|
|
|
|
+#if defined(__GNUC__)
|
|
|
|
|
+/* Use GCC built-in functions */
|
|
|
|
|
+#define _PR_HAVE_ATOMIC_OPS
|
|
|
|
|
+#define _MD_INIT_ATOMIC()
|
|
|
|
|
+#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1)
|
|
|
|
|
+#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1)
|
|
|
|
|
+#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i)
|
|
|
|
|
+#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv)
|
|
|
|
|
+#else
|
|
|
|
|
#define _PR_HAVE_ATOMIC_OPS
|
|
|
|
|
#define _MD_INIT_ATOMIC()
|
|
|
|
|
extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val);
|
2022-12-28 15:39:25 +08:00
|
|
|
@@ -116,6 +125,7 @@ extern PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
2020-07-24 01:42:00 +00:00
|
|
|
extern PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
|
|
|
|
|
#define _MD_ATOMIC_SET _PR_x86_AtomicSet
|
|
|
|
|
#endif
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
#if defined(__ia64__)
|
|
|
|
|
#define _PR_HAVE_ATOMIC_OPS
|
2022-12-28 15:39:25 +08:00
|
|
|
@@ -131,6 +141,15 @@ extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval);
|
2020-07-24 01:42:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(__x86_64__)
|
|
|
|
|
+#if defined(__GNUC__)
|
|
|
|
|
+/* Use GCC built-in functions */
|
|
|
|
|
+#define _PR_HAVE_ATOMIC_OPS
|
|
|
|
|
+#define _MD_INIT_ATOMIC()
|
|
|
|
|
+#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1)
|
|
|
|
|
+#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1)
|
|
|
|
|
+#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i)
|
|
|
|
|
+#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv)
|
|
|
|
|
+#else
|
|
|
|
|
#define _PR_HAVE_ATOMIC_OPS
|
|
|
|
|
#define _MD_INIT_ATOMIC()
|
|
|
|
|
extern PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val);
|
2022-12-28 15:39:25 +08:00
|
|
|
@@ -142,6 +161,7 @@ extern PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
2020-07-24 01:42:00 +00:00
|
|
|
extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval);
|
|
|
|
|
#define _MD_ATOMIC_SET _PR_x86_64_AtomicSet
|
|
|
|
|
#endif
|
|
|
|
|
+#endif
|
|
|
|
|
|
2022-12-28 15:39:25 +08:00
|
|
|
#if defined(__loongarch__)
|
2020-07-24 01:42:00 +00:00
|
|
|
#if defined(__GNUC__)
|
2022-12-28 15:39:25 +08:00
|
|
|
--
|
|
|
|
|
2.32.1 (Apple Git-133)
|
|
|
|
|
|