(unnamed)

text/plain

Filename: (unnamed)
Type: text/plain
Part: 0
Message: Re: [PATCHES] Patch to make Turks happy.
Index: s_lock.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/storage/s_lock.h,v
retrieving revision 1.102
retrieving revision 1.103
diff -c -c -r1.102 -r1.103
*** s_lock.h	10 Nov 2002 00:33:43 -0000	1.102
--- s_lock.h	22 Nov 2002 01:13:16 -0000	1.103
***************
*** 63,69 ****
   * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  *	  $Id: s_lock.h,v 1.102 2002/11/10 00:33:43 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 63,69 ----
   * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  *	  $Id: s_lock.h,v 1.103 2002/11/22 01:13:16 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
***************
*** 150,156 ****
  
  #endif	 /* __arm__ */
  
! #if defined(__s390__) || defined(__s390x__)
  /*
   * S/390 Linux
   */
--- 150,157 ----
  
  #endif	 /* __arm__ */
  
! 
! #if defined(__s390__) && !defined(__s390x__)
  /*
   * S/390 Linux
   */
***************
*** 175,180 ****
--- 176,207 ----
  }
  
  #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__)