6363 * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
6464 * Portions Copyright (c) 1994, Regents of the University of California
6565 *
66- * $Id: s_lock.h,v 1.102 2002/11/10 00:33:43 momjian Exp $
66+ * $Id: s_lock.h,v 1.103 2002/11/22 01:13:16 tgl Exp $
6767 *
6868 *-------------------------------------------------------------------------
6969 */
@@ -150,7 +150,8 @@ tas(volatile slock_t *lock)
150150
151151#endif /* __arm__ */
152152
153- #if defined(__s390__ )|| defined(__s390x__ )
153+
154+ #if defined(__s390__ )&& !defined(__s390x__ )
154155/*
155156 * S/390 Linux
156157 */
@@ -176,6 +177,32 @@ tas(volatile slock_t *lock)
176177
177178#endif /* __s390__ */
178179
180+ #if defined(__s390x__ )
181+ /*
182+ * S/390x Linux (64-bit zSeries)
183+ */
184+ #define TAS (lock ) tas(lock)
185+
186+ static __inline__int
187+ tas (volatile slock_t * lock )
188+ {
189+ int _res ;
190+
191+ __asm____volatile__(
192+ "la1,1\n"
193+ "lg 2,%2\n"
194+ "slr 0,0\n"
195+ "cs 0,1,0(2)\n"
196+ "lr %1,0\n"
197+ :"=m" (lock ),"=d" (_res )
198+ :"m" (lock )
199+ :"0" ,"1" ,"2" );
200+
201+ return (_res );
202+ }
203+
204+ #endif /* __s390x__ */
205+
179206
180207#if defined(__sparc__ )
181208#define TAS (lock ) tas(lock)