aboutsummaryrefslogtreecommitdiff
path: root/db2/mutex
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-02 06:01:06 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-02 06:01:06 +0000
commit8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3 (patch)
tree099a250d7366aef2ab028fdb24f0d692cd784b4a /db2/mutex
parent9a6450d578556c11e7c173d2f28362345b8f1258 (diff)
downloadglibc-8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3.tar
glibc-8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3.tar.gz
glibc-8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3.tar.bz2
glibc-8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3.zip
Update.
* Makeconfig (all-subdirs): Remove db and db2. * db/*: Removed. * db2/*: Removed.
Diffstat (limited to 'db2/mutex')
-rw-r--r--db2/mutex/68020.gcc18
-rw-r--r--db2/mutex/README105
-rw-r--r--db2/mutex/alpha.h26
-rw-r--r--db2/mutex/mutex.c318
-rw-r--r--db2/mutex/parisc.gcc36
-rw-r--r--db2/mutex/sco.cc24
-rw-r--r--db2/mutex/sparc.gcc31
-rw-r--r--db2/mutex/tsl_parisc.s65
-rw-r--r--db2/mutex/uts4_cc.s21
-rw-r--r--db2/mutex/x86.gcc17
10 files changed, 0 insertions, 661 deletions
diff --git a/db2/mutex/68020.gcc b/db2/mutex/68020.gcc
deleted file mode 100644
index 21410e61d4..0000000000
--- a/db2/mutex/68020.gcc
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * @(#)68020.gcc 10.2 (Sleepycat) 2/15/98
- *
- * For gcc/68K, 0 is clear, 1 is set.
- */
-#define TSL_SET(tsl) ({ \
- register tsl_t *__l = (tsl); \
- int __r; \
- asm volatile("tas %1; \n \
- seq %0" \
- : "=dm" (__r), "=m" (*__l) \
- : "1" (*__l) \
- ); \
- __r & 1; \
-})
-
-#define TSL_UNSET(tsl) (*(tsl) = 0)
-#define TSL_INIT(tsl) TSL_UNSET(tsl)
diff --git a/db2/mutex/README b/db2/mutex/README
deleted file mode 100644
index fceeef7ed8..0000000000
--- a/db2/mutex/README
+++ /dev/null
@@ -1,105 +0,0 @@
-# @(#)README 10.2 (Sleepycat) 11/25/97
-
-Resource locking routines: lock based on a db_mutex_t. All this gunk
-(including trying to make assembly code portable), is necessary because
-System V semaphores require system calls for uncontested locks and we
-don't want to make two system calls per resource lock.
-
-First, this is how it works. The db_mutex_t structure contains a resource
-test-and-set lock (tsl), a file offset, a pid for debugging and statistics
-information.
-
-If HAVE_SPINLOCKS is defined (i.e. we know how to do test-and-sets for
-this compiler/architecture combination), we try and lock the resource tsl
-__db_tsl_spins times. If we can't acquire the lock that way, we use a
-system call to sleep for 10ms, 20ms, 40ms, etc. (The time is bounded at
-1 second, just in case.) Using the timer backoff means that there are
-two assumptions: that locks are held for brief periods (never over system
-calls or I/O) and that locks are not hotly contested.
-
-If HAVE_SPINLOCKS is not defined, i.e. we can't do test-and-sets, we use
-a file descriptor to do byte locking on a file at a specified offset. In
-this case, ALL of the locking is done in the kernel. Because file
-descriptors are allocated per process, we have to provide the file
-descriptor as part of the lock/unlock call. We still have to do timer
-backoff because we need to be able to block ourselves, i.e. the lock
-manager causes processes to wait by having the process acquire a mutex
-and then attempting to re-acquire the mutex. There's no way to use kernel
-locking to block yourself, i.e. if you hold a lock and attempt to
-re-acquire it, the attempt will succeed.
-
-Next, let's talk about why it doesn't work the way a reasonable person
-would think it should work.
-
-Ideally, we'd have the ability to try to lock the resource tsl, and if
-that fails, increment a counter of waiting processes, then block in the
-kernel until the tsl is released. The process holding the resource tsl
-would see the wait counter when it went to release the resource tsl, and
-would wake any waiting processes up after releasing the lock. This would
-actually require both another tsl (call it the mutex tsl) and
-synchronization between the call that blocks in the kernel and the actual
-resource tsl. The mutex tsl would be used to protect accesses to the
-db_mutex_t itself. Locking the mutex tsl would be done by a busy loop,
-which is safe because processes would never block holding that tsl (all
-they would do is try to obtain the resource tsl and set/check the wait
-count). The problem in this model is that the blocking call into the
-kernel requires a blocking semaphore, i.e. one whose normal state is
-locked.
-
-The only portable forms of locking under UNIX are fcntl(2) on a file
-descriptor/offset, and System V semaphores. Neither of these locking
-methods are sufficient to solve the problem.
-
-The problem with fcntl locking is that only the process that obtained the
-lock can release it. Remember, we want the normal state of the kernel
-semaphore to be locked. So, if the creator of the db_mutex_t were to
-initialize the lock to "locked", then a second process locks the resource
-tsl, and then a third process needs to block, waiting for the resource
-tsl, when the second process wants to wake up the third process, it can't
-because it's not the holder of the lock! For the second process to be
-the holder of the lock, we would have to make a system call per
-uncontested lock, which is what we were trying to get away from in the
-first place.
-
-There are some hybrid schemes, such as signaling the holder of the lock,
-or using a different blocking offset depending on which process is
-holding the lock, but it gets complicated fairly quickly. I'm open to
-suggestions, but I'm not holding my breath.
-
-Regardless, we use this form of locking when HAVE_SPINLOCKS is not
-defined, (i.e. we're locking in the kernel) because it doesn't have the
-limitations found in System V semaphores, and because the normal state of
-the kernel object in that case is unlocked, so the process releasing the
-lock is also the holder of the lock.
-
-The System V semaphore design has a number of other limitations that make
-it inappropriate for this task. Namely:
-
-First, the semaphore key name space is separate from the file system name
-space (although there exist methods for using file names to create
-semaphore keys). If we use a well-known key, there's no reason to believe
-that any particular key will not already be in use, either by another
-instance of the DB application or some other application, in which case
-the DB application will fail. If we create a key, then we have to use a
-file system name to rendezvous and pass around the key.
-
-Second, System V semaphores traditionally have compile-time, system-wide
-limits on the number of semaphore keys that you can have. Typically, that
-number is far too low for any practical purpose. Since the semaphores
-permit more than a single slot per semaphore key, we could try and get
-around that limit by using multiple slots, but that means that the file
-that we're using for rendezvous is going to have to contain slot
-information as well as semaphore key information, and we're going to be
-reading/writing it on every db_mutex_t init or destroy operation. Anyhow,
-similar compile-time, system-wide limits on the numbers of slots per
-semaphore key kick in, and you're right back where you started.
-
-My fantasy is that once POSIX.1 standard mutexes are in wide-spread use,
-we can switch to them. My guess is that it won't happen, because the
-POSIX semaphores are only required to work for threads within a process,
-and not independent processes.
-
-Note: there are races in the statistics code, but since it's just that,
-I didn't bother fixing them. (The fix requires a mutex tsl, so, when/if
-this code is fixed to do rational locking (see above), then change the
-statistics update code to acquire/release the mutex tsl.
diff --git a/db2/mutex/alpha.h b/db2/mutex/alpha.h
deleted file mode 100644
index ad3afc4544..0000000000
--- a/db2/mutex/alpha.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* For alpha, 0 is clear, 1 is set. */
-
-#ifdef __GNUC__
-#define TSL_SET(tsl) ({ \
- register tsl_t *__l = (tsl); \
- int __r; \
- asm volatile( \
- "1: ldl_l %0,%1\n" \
- " blbs %0,2f\n" \
- " mov 1,%0\n" \
- " stl_c %0,%1\n" \
- " bne %0,1b\n" \
- " mb\n" \
- "2:" \
- : "=&r"(__r), "=m"(*__l) : "m"(*__l) : "memory"); \
- __r; \
-})
-#endif
-
-#ifdef __DECC
-#include <alpha/builtins.h>
-#define TSL_SET(tsl) (__LOCK_LONG_RETRY((tsl), 1) != 0)
-#endif
-
-#define TSL_UNSET(tsl) (*(tsl) = 0)
-#define TSL_INIT(tsl) TSL_UNSET(tsl)
diff --git a/db2/mutex/mutex.c b/db2/mutex/mutex.c
deleted file mode 100644
index 2fac14cf3d..0000000000
--- a/db2/mutex/mutex.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 1996, 1997, 1998
- * Sleepycat Software. All rights reserved.
- */
-
-#include "config.h"
-
-#ifndef lint
-static const char sccsid[] = "@(#)mutex.c 10.52 (Sleepycat) 11/8/98";
-#endif /* not lint */
-
-#ifndef NO_SYSTEM_INCLUDES
-#include <sys/types.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#endif
-
-#include "db_int.h"
-
-#ifdef HAVE_SPINLOCKS
-
-#ifdef HAVE_FUNC_AIX
-#define TSL_INIT(x)
-#define TSL_SET(x) (!_check_lock(x, 0, 1))
-#define TSL_UNSET(x) _clear_lock(x, 0)
-#endif
-
-#ifdef HAVE_ASSEM_MC68020_GCC
-#include "68020.gcc"
-#endif
-
-#if defined(HAVE_FUNC_MSEM)
-/*
- * !!!
- * Do not remove the MSEM_IF_NOWAIT flag. The problem is that if a single
- * process makes two msem_lock() calls in a row, the second one returns an
- * error. We depend on the fact that we can lock against ourselves in the
- * locking subsystem, where we set up a mutex so that we can block ourselves.
- * Tested on OSF1 v4.0.
- */
-#define TSL_INIT(x) (msem_init(x, MSEM_UNLOCKED) == NULL)
-#define TSL_INIT_ERROR 1
-#define TSL_SET(x) (!msem_lock(x, MSEM_IF_NOWAIT))
-#define TSL_UNSET(x) msem_unlock(x, 0)
-#endif
-
-#ifdef HAVE_FUNC_RELIANT
-#define TSL_INIT(x) initspin(x, 1)
-#define TSL_SET(x) (cspinlock(x) == 0)
-#define TSL_UNSET(x) spinunlock(x)
-#endif
-
-#ifdef HAVE_FUNC_SGI
-#define TSL_INIT(x) (init_lock(x) != 0)
-#define TSL_INIT_ERROR 1
-#define TSL_SET(x) (!acquire_lock(x))
-#define TSL_UNSET(x) release_lock(x)
-#endif
-
-#ifdef HAVE_FUNC_SOLARIS
-/*
- * Semaphore calls don't work on Solaris 5.5.
- *
- * #define TSL_INIT(x) (sema_init(x, 1, USYNC_PROCESS, NULL) != 0)
- * #define TSL_INIT_ERROR 1
- * #define TSL_SET(x) (sema_wait(x) == 0)
- * #define TSL_UNSET(x) sema_post(x)
- */
-#define TSL_INIT(x)
-#define TSL_SET(x) (_lock_try(x))
-#define TSL_UNSET(x) _lock_clear(x)
-#endif
-
-#ifdef HAVE_FUNC_VMS
-#include <builtins.h>
-#ifdef __ALPHA
-#define TSL_SET(tsl) (!__TESTBITSSI(tsl, 0))
-#else /* __VAX */
-#define TSL_SET(tsl) (!(int)_BBSSI(0, tsl))
-#endif
-#define TSL_UNSET(tsl) (*(tsl) = 0)
-#define TSL_INIT(tsl) TSL_UNSET(tsl)
-#endif
-
-#ifdef HAVE_ASSEM_PARISC_GCC
-#include "parisc.gcc"
-#endif
-
-#ifdef HAVE_ASSEM_SCO_CC
-#include "sco.cc"
-#endif
-
-#ifdef HAVE_ASSEM_SPARC_GCC
-#include "sparc.gcc"
-#endif
-
-#ifdef HAVE_ASSEM_UTS4_CC
-#define TSL_INIT(x)
-#define TSL_SET(x) (!uts_lock(x, 1))
-#define TSL_UNSET(x) (*(x) = 0)
-#endif
-
-#ifdef HAVE_ASSEM_X86_GCC
-#include "x86.gcc"
-#endif
-
-#ifdef HAVE_ASSEM_ALPHA
-#include "alpha.h"
-#endif
-
-#ifdef WIN16
-/* Win16 spinlocks are simple because we cannot possibly be preempted. */
-#define TSL_INIT(tsl)
-#define TSL_SET(tsl) (*(tsl) = 1)
-#define TSL_UNSET(tsl) (*(tsl) = 0)
-#endif
-
-#if defined(_WIN32)
-/*
- * XXX
- * DBDB this needs to be byte-aligned!!
- */
-#define TSL_INIT(tsl)
-#define TSL_SET(tsl) (!InterlockedExchange((PLONG)tsl, 1))
-#define TSL_UNSET(tsl) (*(tsl) = 0)
-#endif
-
-#endif /* HAVE_SPINLOCKS */
-
-/*
- * __db_mutex_init --
- * Initialize a DB mutex structure.
- *
- * PUBLIC: int __db_mutex_init __P((db_mutex_t *, u_int32_t));
- */
-int
-__db_mutex_init(mp, off)
- db_mutex_t *mp;
- u_int32_t off;
-{
-#ifdef DIAGNOSTIC
- if ((ALIGNTYPE)mp & (MUTEX_ALIGNMENT - 1)) {
- (void)fprintf(stderr,
- "MUTEX ERROR: mutex NOT %d-byte aligned!\n",
- MUTEX_ALIGNMENT);
- abort();
- }
-#endif
- memset(mp, 0, sizeof(db_mutex_t));
-
-#ifdef HAVE_SPINLOCKS
- COMPQUIET(off, 0);
-
-#ifdef TSL_INIT_ERROR
- if (TSL_INIT(&mp->tsl_resource))
- return (errno);
-#else
- TSL_INIT(&mp->tsl_resource);
-#endif
- mp->spins = __os_spin();
-#else
- mp->off = off;
-#endif
- return (0);
-}
-
-#define MS(n) ((n) * 1000) /* Milliseconds to micro-seconds. */
-#define SECOND (MS(1000)) /* A second's worth of micro-seconds. */
-
-/*
- * __db_mutex_lock
- * Lock on a mutex, logically blocking if necessary.
- *
- * PUBLIC: int __db_mutex_lock __P((db_mutex_t *, int));
- */
-int
-__db_mutex_lock(mp, fd)
- db_mutex_t *mp;
- int fd;
-{
- u_long usecs;
-#ifdef HAVE_SPINLOCKS
- int nspins;
-#else
- struct flock k_lock;
- pid_t mypid;
- int locked;
-#endif
-
- if (!DB_GLOBAL(db_mutexlocks))
- return (0);
-
-#ifdef HAVE_SPINLOCKS
- COMPQUIET(fd, 0);
-
- for (usecs = MS(1);;) {
- /* Try and acquire the uncontested resource lock for N spins. */
- for (nspins = mp->spins; nspins > 0; --nspins)
- if (TSL_SET(&mp->tsl_resource)) {
-#ifdef DIAGNOSTIC
- if (mp->pid != 0) {
- (void)fprintf(stderr,
- "MUTEX ERROR: __db_mutex_lock: lock currently locked\n");
- abort();
- }
- mp->pid = getpid();
-#endif
- if (usecs == MS(1))
- ++mp->mutex_set_nowait;
- else
- ++mp->mutex_set_wait;
- return (0);
- }
-
- /* Yield the processor; wait 1ms initially, up to 1 second. */
- __os_yield(usecs);
- if ((usecs <<= 1) > SECOND)
- usecs = SECOND;
- }
- /* NOTREACHED */
-
-#else /* !HAVE_SPINLOCKS */
-
- /* Initialize the lock. */
- k_lock.l_whence = SEEK_SET;
- k_lock.l_start = mp->off;
- k_lock.l_len = 1;
-
- for (locked = 0, mypid = getpid();;) {
- /*
- * Wait for the lock to become available; wait 1ms initially,
- * up to 1 second.
- */
- for (usecs = MS(1); mp->pid != 0;) {
- __os_yield(usecs);
- if ((usecs <<= 1) > SECOND)
- usecs = SECOND;
- }
-
- /* Acquire an exclusive kernel lock. */
- k_lock.l_type = F_WRLCK;
- if (fcntl(fd, F_SETLKW, &k_lock))
- return (errno);
-
- /* If the resource tsl is still available, it's ours. */
- if (mp->pid == 0) {
- locked = 1;
- mp->pid = mypid;
- }
-
- /* Release the kernel lock. */
- k_lock.l_type = F_UNLCK;
- if (fcntl(fd, F_SETLK, &k_lock))
- return (errno);
-
- /*
- * If we got the resource tsl we're done.
- *
- * !!!
- * We can't check to see if the lock is ours, because we may
- * be trying to block ourselves in the lock manager, and so
- * the holder of the lock that's preventing us from getting
- * the lock may be us! (Seriously.)
- */
- if (locked)
- break;
- }
- return (0);
-#endif /* !HAVE_SPINLOCKS */
-}
-
-/*
- * __db_mutex_unlock --
- * Release a lock.
- *
- * PUBLIC: int __db_mutex_unlock __P((db_mutex_t *, int));
- */
-int
-__db_mutex_unlock(mp, fd)
- db_mutex_t *mp;
- int fd;
-{
- if (!DB_GLOBAL(db_mutexlocks))
- return (0);
-
-#ifdef DIAGNOSTIC
- if (mp->pid == 0) {
- (void)fprintf(stderr,
- "MUTEX ERROR: __db_mutex_unlock: lock already unlocked\n");
- abort();
- }
-#endif
-
-#ifdef HAVE_SPINLOCKS
- COMPQUIET(fd, 0);
-
-#ifdef DIAGNOSTIC
- mp->pid = 0;
-#endif
-
- /* Release the resource tsl. */
- TSL_UNSET(&mp->tsl_resource);
-#else
- /*
- * Release the resource tsl. We don't have to acquire any locks
- * because processes trying to acquire the lock are checking for
- * a pid of 0, not a specific value.
- */
- mp->pid = 0;
-#endif
- return (0);
-}
diff --git a/db2/mutex/parisc.gcc b/db2/mutex/parisc.gcc
deleted file mode 100644
index 2e4540f767..0000000000
--- a/db2/mutex/parisc.gcc
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * @(#)parisc.gcc 8.8 (Sleepycat) 6/2/98
- *
- * Copyright (c) 1996-1997, The University of Utah and the Computer Systems
- * Laboratory at the University of Utah (CSL). All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the Computer
- * Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- */
-
-/*
- * The PA-RISC has a "load and clear" instead of a "test and set" instruction.
- * The 32-bit word used by that instruction must be 16-byte aligned. We could
- * use the "aligned" attribute in GCC but that doesn't work for stack variables.
- */
-#define TSL_SET(tsl) ({ \
- register tsl_t *__l = (tsl); \
- int __r; \
- asm volatile("ldcws 0(%1),%0" : "=r" (__r) : "r" (__l)); \
- __r & 1; \
-})
-
-#define TSL_UNSET(tsl) (*(tsl) = -1)
-#define TSL_INIT(tsl) TSL_UNSET(tsl)
diff --git a/db2/mutex/sco.cc b/db2/mutex/sco.cc
deleted file mode 100644
index 7c165a2072..0000000000
--- a/db2/mutex/sco.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * @(#)x86.uslc
- *
- * UnixWare has threads in libthread, but OpenServer doesn't (yet).
- *
- * For cc/x86, 0 is clear, 1 is set.
- */
-
-#if defined(__USLC__)
-asm int
-_tsl_set(void *tsl)
-{
-%mem tsl
- movl tsl, %ecx
- movl $1, %eax
- lock
- xchgb (%ecx),%al
- xorl $1,%eax
-}
-#endif
-
-#define TSL_SET(tsl) _tsl_set(tsl)
-#define TSL_UNSET(tsl) (*(tsl) = 0)
-#define TSL_INIT(tsl) TSL_UNSET(tsl)
diff --git a/db2/mutex/sparc.gcc b/db2/mutex/sparc.gcc
deleted file mode 100644
index 5eff1764c8..0000000000
--- a/db2/mutex/sparc.gcc
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * @(#)sparc.gcc 10.1 (Sleepycat) 4/12/97
- *
- * The ldstub instruction takes the location specified by its first argument
- * (a register containing a memory address) and loads its contents into its
- * second argument (a register) and atomically sets the contents the location
- * specified by its first argument to a byte of 1s. (The value in the second
- * argument is never read, but only overwritten.)
- *
- * The membar instructions are needed to ensure that writes to the lock are
- * correctly ordered with writes that occur later in the instruction stream.
- *
- * For gcc/sparc, 0 is clear, 1 is set.
- */
-
-/* The stbar is needed for v8, and is implemented as membar #sync on v9,
- so is functional there as well. For v7, stbar may generate an illegal
- instruction and we have no way to tell what we're running on. Some
- operating systems notice and skip this instruction in the fault handler. */
-
-#define TSL_SET(tsl) ({ \
- register tsl_t *__l = (tsl); \
- register tsl_t __r; \
- __asm__ volatile \
- ("ldstub [%1],%0; stbar" \
- : "=r"( __r) : "r" (__l)); \
- !__r; \
-})
-
-#define TSL_UNSET(tsl) (*(tsl) = 0)
-#define TSL_INIT(tsl) TSL_UNSET(tsl)
diff --git a/db2/mutex/tsl_parisc.s b/db2/mutex/tsl_parisc.s
deleted file mode 100644
index e6054944ec..0000000000
--- a/db2/mutex/tsl_parisc.s
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1996-1997 The University of Utah and the Computer Systems
- * Laboratory at the University of Utah (CSL). All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the Computer
- * Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- *
- * @(#)tsl_parisc.s 8.4 (Sleepycat) 1/18/97
- */
-
-/*
- * Spin locks for the PA-RISC. Based on Bob Wheeler's Mach implementation.
- */
- .SPACE $TEXT$
- .SUBSPA $CODE$
-
-/*
- * int tsl_set(tsl_t *tsl)
- *
- * Try to acquire a lock, return 1 if successful, 0 if not.
- */
- .EXPORT tsl_set,ENTRY
-tsl_set
- .PROC
- .CALLINFO FRAME=0,NO_CALLS
- .ENTRY
- ldo 15(%r26),%r26
- depi 0,31,4,%r26
- ldcws 0(%r26),%r28
- subi,= 0,%r28,%r0
- ldi 1,%r28
- bv,n 0(%r2)
- .EXIT
- .PROCEND
-
-
-/*
- * void tsl_unset(tsl_t *tsl)
- *
- * Release a lock.
- */
- .EXPORT tsl_unset,ENTRY
-tsl_unset
- .PROC
- .CALLINFO FRAME=0,NO_CALLS
- .ENTRY
- ldo 15(%r26),%r26
- ldi -1,%r19
- depi 0,31,4,%r26
- bv 0(%r2)
- stw %r19,0(%r26)
- .EXIT
- .PROCEND
diff --git a/db2/mutex/uts4_cc.s b/db2/mutex/uts4_cc.s
deleted file mode 100644
index ee5f4143bd..0000000000
--- a/db2/mutex/uts4_cc.s
+++ /dev/null
@@ -1,21 +0,0 @@
- /
- / int uts_lock ( int *p, int i );
- / Update the lock word pointed to by p with the
- / value i, using compare-and-swap.
- / Returns 0 if update was successful.
- / Returns 1 if update failed.
- /
- entry uts_lock
- uts_lock:
- using .,r15
- st r2,8(sp) / Save R2
- l r2,64+0(sp) / R2 -> word to update
- slr r0, r0 / R0 = current lock value must be 0
- l r1,64+4(sp) / R1 = new lock value
- cs r0,r1,0(r2) / Try the update ...
- be x / ... Success. Return 0
- la r0,1 / ... Failure. Return 1
- x: /
- l r2,8(sp) / Restore R2
- b 2(,r14) / Return to caller
- drop r15
diff --git a/db2/mutex/x86.gcc b/db2/mutex/x86.gcc
deleted file mode 100644
index 566b9c4433..0000000000
--- a/db2/mutex/x86.gcc
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * @(#)x86.gcc 10.3 (Sleepycat) 8/27/97
- *
- * For gcc/x86, 0 is clear, 1 is set.
- */
-#define TSL_SET(tsl) ({ \
- register tsl_t *__l = (tsl); \
- int __r; \
- asm volatile("movl $1,%%eax; lock; xchgb %1,%%al; xorl $1,%%eax"\
- : "=&a" (__r), "=m" (*__l) \
- : "1" (*__l) \
- ); \
- __r & 1; \
-})
-
-#define TSL_UNSET(tsl) (*(tsl) = 0)
-#define TSL_INIT(tsl) TSL_UNSET(tsl)