diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-06-04 15:42:02 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-06-04 15:42:21 -0400 |
commit | 612ecf311bf253cdb0c54252854c5298aa668203 (patch) | |
tree | d07e5f6b954322a68ab2ab7e02067620bc698fa8 /src | |
parent | 81fe138ba252987815506caa57719822709b730f (diff) |
Add ARM64 (aarch64) support to s_lock.h.
Use the same gcc atomic functions as we do on newer ARM chips.
(Basically this is a copy and paste of the __arm__ code block,
but omitting the SWPB option since that definitely won't work.)
Back-patch to 9.2. The patch would work further back, but we'd also
need to update config.guess/config.sub in older branches to make them
build out-of-the-box, and there hasn't been demand for it.
Mark Salter
Diffstat (limited to 'src')
-rw-r--r-- | src/include/storage/s_lock.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index d4a783f63d4..29124b19a56 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 |