From af3bf1a27ca0ff48eddf65657f28c57f4a5df2ca Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 22 Nov 2002 01:13:28 +0000 Subject: [PATCH] TAS code originally written for s390 (32-bit) does not work for s390x (64-bit). Fix it. Per report from Permaine Cheung. --- src/include/storage/s_lock.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 830666d379..734035a3de 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -150,7 +150,8 @@ tas(volatile slock_t *lock) #endif /* __arm__ */ -#if defined(__s390__) || defined(__s390x__) + +#if defined(__s390__) && !defined(__s390x__) /* * S/390 Linux */ @@ -176,6 +177,32 @@ tas(volatile slock_t *lock) #endif /* __s390__ */ +#if defined(__s390x__) +/* + * S/390x Linux (64-bit zSeries) + */ +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + int _res; + + __asm__ __volatile__( + " la 1,1 \n" + " lg 2,%2 \n" + " slr 0,0 \n" + " cs 0,1,0(2) \n" + " lr %1,0 \n" +: "=m"(lock), "=d"(_res) +: "m"(lock) +: "0", "1", "2"); + + return (_res); +} + +#endif /* __s390x__ */ + #if defined(__sparc__) #define TAS(lock) tas(lock) -- 2.39.5