Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5c7603c

Browse files
committed
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
1 parent dbc6eb1 commit 5c7603c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/include/storage/s_lock.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,29 @@ tas(volatile slock_t *lock)
336336
#endif /* __arm__ */
337337

338338

339+
/*
340+
* On ARM64, we use __sync_lock_test_and_set(int *, int) if available.
341+
*/
342+
#if defined(__aarch64__) || defined(__aarch64)
343+
#ifdef HAVE_GCC_INT_ATOMICS
344+
#define HAS_TEST_AND_SET
345+
346+
#define TAS(lock) tas(lock)
347+
348+
typedef int slock_t;
349+
350+
static __inline__ int
351+
tas(volatile slock_t *lock)
352+
{
353+
return __sync_lock_test_and_set(lock, 1);
354+
}
355+
356+
#define S_UNLOCK(lock) __sync_lock_release(lock)
357+
358+
#endif /* HAVE_GCC_INT_ATOMICS */
359+
#endif /* __aarch64__ */
360+
361+
339362
/* S/390 and S/390x Linux (32- and 64-bit zSeries) */
340363
#if defined(__s390__) || defined(__s390x__)
341364
#define HAS_TEST_AND_SET

0 commit comments

Comments
 (0)