]> granicus.if.org Git - postgresql/commitdiff
Here's the new diff for getting the NS32K assembly code into the
authorBruce Momjian <bruce@momjian.us>
Fri, 2 Oct 1998 15:23:08 +0000 (15:23 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 2 Oct 1998 15:23:08 +0000 (15:23 +0000)
spin-locks.  Notice that it's now inline assembler in s_lock.h,
rather than seperate code in s_lock.c.  It also shrank a little
bit...  Just rip out the S_LOCK() define and insert the tas() inline
function.  Please let me know if there are any problems with it.

Jon Buller

src/include/storage/s_lock.h

index eb9a808f099582b8a798aa60623ba6f01fc711cd..b094ed8fb8d7e81bcf92a656dc636d6bf2893ccd 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.51 1998/10/01 01:53:50 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.52 1998/10/02 15:23:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -168,6 +168,22 @@ tas(volatile slock_t *lock)
 
 
 
+#if defined(NEED_NS32K_TAS_ASM)
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+  register _res;
+  __asm__("sbitb 0, %0
+       sfsd %1"
+       : "=m"(*lock), "=r"(_res));
+  return (int) _res; 
+}
+
+#endif  /* NEED_NS32K_TAS_ASM */
+
+
 
 #else                                                  /* __GNUC__ */
 /***************************************************************************
@@ -212,24 +228,6 @@ tas(slock_t *s_lock)
 
 #endif  /* NEED_I386_TAS_ASM */
 
-
-
-#if defined(NEED_NS32K_TAS_ASM)
-
-#define S_LOCK(lock)                           \
-{                                              \
-       slock_t res = 1;                                \
-       while (res) {                           \
-         __asm__("movqd 0, r0");                       \
-         __asm__("sbitd r0, %0" : "=m"(*lock));        \
-         __asm__("sprb us, %0" : "=r" (res));  \
-         res = ((res >> 5) & 1);                       \
-       }                                               \
-}
-
-#endif  /* NEED_NS32K_TAS_ASM */
-
-
 #endif  /* defined(__GNUC__) */