From c0cd32d7b4934d9359255b5abd3eb98398528e20 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Tue, 13 Apr 1999 17:42:26 +0000
Subject: [PATCH] Add ARM32 support by Andrew McMurry

---
 src/include/port/bsd.h       |  4 ++++
 src/include/storage/s_lock.h | 18 +++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/include/port/bsd.h b/src/include/port/bsd.h
index cfd0d2811bd..f24f4f83b57 100644
--- a/src/include/port/bsd.h
+++ b/src/include/port/bsd.h
@@ -24,6 +24,10 @@
 #define HAS_TEST_AND_SET
 #endif
 
+#if defined(__arm32__)
+#define HAS_TEST_AND_SET
+#endif
+
 #if defined(__powerpc__)
 #define HAS_TEST_AND_SET
 typedef unsigned int slock_t;
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 3863b55a62d..9aef29bffce 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.58 1999/02/13 23:22:09 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.59 1999/04/13 17:42:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -124,6 +124,22 @@ __asm__("lock; xchgb %0,%1": "=q"(_res), "=m"(*lock):"0"(_res));
 
 
 
+#if defined(__arm32__)
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+        register slock_t _res = 1;
+
+__asm__("swpb %0, %0, [%3]": "=r"(_res), "=m"(*lock):"0"(_res), "r" (lock));
+        return (int) _res;
+}
+
+#endif   /* __arm32__ */
+
+
+
 #if defined(sparc)
 #define TAS(lock) tas(lock)
 
-- 
GitLab