summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBruce Momjian2002-11-10 00:33:43 +0000
committerBruce Momjian2002-11-10 00:33:43 +0000
commitceb4f5ea9c2c6c2bd44d4799ff4a62c40a038894 (patch)
treea6f1fe29c6d2b2ede8cef05f21c1771a9681346f /src/include
parent50e726a2c34523c120486a7c679c2b6d49233973 (diff)
> > I'll re-check that with the ppc architecture guy here.
> > ... he is now about to write an inlined version that can go into > s_lock.h . I'll send the new patch later on... OK, here it comes: An inlined version of tas(), that works for both, powerpc and powerpc64. The patch is against 7.3b5 and passes the test suite on both architectures. Reinhard Max
Diffstat (limited to 'src/include')
-rw-r--r--src/include/port/linux.h5
-rw-r--r--src/include/storage/s_lock.h31
2 files changed, 35 insertions, 1 deletions
diff --git a/src/include/port/linux.h b/src/include/port/linux.h
index d4da17da45c..283799c14d6 100644
--- a/src/include/port/linux.h
+++ b/src/include/port/linux.h
@@ -14,6 +14,11 @@ typedef unsigned char slock_t;
#define HAS_TEST_AND_SET
+#elif defined(__powerpc64__)
+typedef unsigned long slock_t;
+
+#define HAS_TEST_AND_SET
+
#elif defined(__powerpc__)
typedef unsigned int slock_t;
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 1174b13694e..16457507a51 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -63,7 +63,7 @@
* 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.101 2002/09/21 00:14:05 tgl Exp $
+ * $Id: s_lock.h,v 1.102 2002/11/10 00:33:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -194,6 +194,35 @@ tas(volatile slock_t *lock)
#endif /* __sparc__ */
+#if defined(__powerpc__) || defined(__powerpc64__)
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+ slock_t _t;
+ int _res;
+
+ __asm__ __volatile__(
+" lwarx %0,0,%3 \n"
+" cmpwi %0,0 \n"
+" bne 1f \n"
+" addi %0,%0,1 \n"
+" stwcx. %0,0,%3 \n"
+" isync \n"
+" beq 2f \n"
+"1: li %2,1 \n"
+" b 3f \n"
+"2: \n"
+" li %2,0 \n"
+"3: \n"
+
+: "=&r" (_t), "=m" (lock), "=r" (_res)
+: "r" (lock)
+: "cc", "memory"
+ );
+ return _res;
+}
+#endif
+
#if defined(__mc68000__) && defined(__linux__)
#define TAS(lock) tas(lock)