2013-06-13 08:33:54 +00:00
|
|
|
diff --git a/postgresql-9.1.9/src/include/storage/s_lock.h b/postgresql-9.1.9/src/include/storage/s_lock.h
|
|
|
|
index 987fb9c..1ba718c 100644
|
|
|
|
--- a/postgresql-9.1.9/src/include/storage/s_lock.h
|
|
|
|
+++ b/postgresql-9.1.9/src/include/storage/s_lock.h
|
|
|
|
@@ -296,6 +296,29 @@ tas(volatile slock_t *lock)
|
|
|
|
#endif /* __arm__ */
|
|
|
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * On ARM64, we use __sync_lock_test_and_set(int *, int) if available.
|
|
|
|
+ */
|
|
|
|
+#if defined(__aarch64__) || defined(__aarch64)
|
|
|
|
+#ifdef HAVE_GCC_INT_ATOMICS
|
|
|
|
+#define HAS_TEST_AND_SET
|
|
|
|
+
|
|
|
|
+#define TAS(lock) tas(lock)
|
|
|
|
+
|
|
|
|
+typedef int slock_t;
|
|
|
|
+
|
|
|
|
+static __inline__ int
|
|
|
|
+tas(volatile slock_t *lock)
|
|
|
|
+{
|
|
|
|
+ return __sync_lock_test_and_set(lock, 1);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#define S_UNLOCK(lock) __sync_lock_release(lock)
|
|
|
|
+
|
|
|
|
+#endif /* HAVE_GCC_INT_ATOMICS */
|
|
|
|
+#endif /* __aarch64__ */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
/* S/390 and S/390x Linux (32- and 64-bit zSeries) */
|
|
|
|
#if defined(__s390__) || defined(__s390x__)
|
|
|
|
#define HAS_TEST_AND_SET
|
2013-06-05 07:34:58 +00:00
|
|
|
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
|
|
|
|
index d4a783f..29124b1 100644
|
|
|
|
--- a/src/include/storage/s_lock.h
|
|
|
|
+++ b/src/include/storage/s_lock.h
|
|
|
|
@@ -335,6 +335,29 @@ tas(volatile slock_t *lock)
|
|
|
|
#endif /* __arm__ */
|
|
|
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * On ARM64, we use __sync_lock_test_and_set(int *, int) if available.
|
|
|
|
+ */
|
|
|
|
+#if defined(__aarch64__) || defined(__aarch64)
|
|
|
|
+#ifdef HAVE_GCC_INT_ATOMICS
|
|
|
|
+#define HAS_TEST_AND_SET
|
|
|
|
+
|
|
|
|
+#define TAS(lock) tas(lock)
|
|
|
|
+
|
|
|
|
+typedef int slock_t;
|
|
|
|
+
|
|
|
|
+static __inline__ int
|
|
|
|
+tas(volatile slock_t *lock)
|
|
|
|
+{
|
|
|
|
+ return __sync_lock_test_and_set(lock, 1);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#define S_UNLOCK(lock) __sync_lock_release(lock)
|
|
|
|
+
|
|
|
|
+#endif /* HAVE_GCC_INT_ATOMICS */
|
|
|
|
+#endif /* __aarch64__ */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
/* S/390 and S/390x Linux (32- and 64-bit zSeries) */
|
|
|
|
#if defined(__s390__) || defined(__s390x__)
|
|
|
|
#define HAS_TEST_AND_SET
|