1 --- db-3.1.17/dist/aclocal/mutex.m4.jbj Sat Apr 29 15:03:49 2000
2 +++ db-3.1.17/dist/aclocal/mutex.m4 Sat Sep 30 01:03:03 2000
4 }], [db_cv_mutex="ia64/gcc-assembly"])
7 +dnl alphalinux/gcc: Linux
8 +if test "$db_cv_mutex" = no; then
10 +#if defined(__alpha__)
11 +#if defined(__linux__)
16 +}], [db_cv_mutex="alphalinux/gcc-assembly"])
19 +dnl sparc32linux/gcc: Linux
20 +if test "$db_cv_mutex" = no; then
22 +#if defined(__sparc__) && !defined(__arch64__)
23 +#if defined(__linux__)
28 +}], [db_cv_mutex="sparc32linux/gcc-assembly"])
31 +dnl sparc64linux/gcc: Linux
32 +if test "$db_cv_mutex" = no; then
34 +#if defined(__sparc__) && defined(__arch64__)
35 +#if defined(__linux__)
40 +}], [db_cv_mutex="sparc64linux/gcc-assembly"])
44 if test "$db_cv_mutex" = no; then
47 AC_DEFINE(HAVE_MUTEX_UTS_CC_ASSEMBLY);;
48 x86/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
49 AC_DEFINE(HAVE_MUTEX_X86_GCC_ASSEMBLY);;
50 +alphalinux/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
51 + AC_DEFINE(HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY);;
52 +sparc32linux/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
53 + AC_DEFINE(HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY);;
54 +sparc64linux/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
55 + AC_DEFINE(HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY);;
58 --- db-3.1.17/dist/acconfig.h.jbj Tue May 16 11:40:44 2000
59 +++ db-3.1.17/dist/acconfig.h Sat Sep 30 01:03:03 2000
61 #undef HAVE_MUTEX_WIN16
62 #undef HAVE_MUTEX_WIN32
63 #undef HAVE_MUTEX_X86_GCC_ASSEMBLY
64 +#undef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
65 +#undef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
66 +#undef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
68 /* Define if building RPC client/server. */
70 --- db-3.1.17/include/mutex.h.jbj Sat Sep 30 01:10:35 2000
71 +++ db-3.1.17/include/mutex.h Sat Sep 30 01:15:44 2000
73 typedef unsigned char tsl_t;
76 +/*********************************************************************
77 + * alphalinux/gcc assembly.
78 + *********************************************************************/
79 +#ifdef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
80 +typedef unsigned long int tsl_t;
82 +#define MUTEX_ALIGN 8
85 +/*********************************************************************
86 + * sparc32linux/gcc assembly.
87 + *********************************************************************/
88 +#ifdef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
89 +typedef unsigned char tsl_t;
92 +/*********************************************************************
93 + * sparc64linux/gcc assembly.
94 + *********************************************************************/
95 +#ifdef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
96 +typedef unsigned char tsl_t;
100 * Mutex alignment defaults to one byte.
102 --- db-3.1.17/mutex/sparc32linux.gcc.jbj Sat Sep 30 01:03:03 2000
103 +++ db-3.1.17/mutex/sparc32linux.gcc Sat Sep 30 01:03:03 2000
107 + * The ldstub instruction takes the location specified by its first argument
108 + * (a register containing a memory address) and loads its contents into its
109 + * second argument (a register) and atomically sets the contents the location
110 + * specified by its first argument to a byte of 1s. (The value in the second
111 + * argument is never read, but only overwritten.)
113 + * The stbar is needed for v8, and is implemented as membar #sync on v9,
114 + + so is functional there as well. For v7, stbar may generate an illegal
115 + + instruction and we have no way to tell what we're running on. Some
116 + + operating systems notice and skip this instruction in the fault handler.
118 + * For gcc/sparc, 0 is clear, 1 is set.
120 + * Adapted from glibc-2.1.94 pthreads/sysdeps/sparc/sparc32/pspinlock.c.
122 +#define MUTEX_SET(tsl) ({ \
123 + register tsl_t *__l = (tsl); \
124 + register tsl_t __r; \
126 + ("ldstub [%1], %0" \
133 +#define MUTEX_UNSET(tsl) (*(tsl) = 0)
134 +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl)
135 --- db-3.1.17/mutex/mut_tas.c.jbj Wed May 31 17:38:14 2000
136 +++ db-3.1.17/mutex/mut_tas.c Sat Sep 30 01:03:03 2000
138 #ifdef HAVE_MUTEX_X86_GCC_ASSEMBLY
141 +#ifdef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
142 +#include "alphalinux.gcc"
144 +#ifdef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
145 +#include "sparc32linux.gcc"
147 +#ifdef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
148 +#include "sparc64linux.gcc"
153 --- db-3.1.17/mutex/sparc64linux.gcc.jbj Sat Sep 30 01:03:03 2000
154 +++ db-3.1.17/mutex/sparc64linux.gcc Sat Sep 30 01:03:03 2000
160 + * The ldstub instruction takes the location specified by its first argument
161 + * (a register containing a memory address) and loads its contents into its
162 + * second argument (a register) and atomically sets the contents the location
163 + * specified by its first argument to a byte of 1s. (The value in the second
164 + * argument is never read, but only overwritten.)
166 + * The stbar is needed for v8, and is implemented as membar #sync on v9,
167 + + so is functional there as well. For v7, stbar may generate an illegal
168 + + instruction and we have no way to tell what we're running on. Some
169 + + operating systems notice and skip this instruction in the fault handler.
171 + * For gcc/sparc, 0 is clear, 1 is set.
173 + * Adapted from glibc-2.1.94 pthreads/sysdeps/sparc/sparc64/pspinlock.c.
175 +#define MUTEX_SET(tsl) ({ \
176 + register tsl_t *__l = (tsl); \
177 + register tsl_t __r; \
179 + ("ldstub [%1], %0\n" \
180 + "membar #StoreLoad | #StoreStore" \
187 +#define MUTEX_UNSET(tsl) (*(tsl) = 0)
188 +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl)
189 --- db-3.1.17/mutex/alphalinux.gcc.jbj Sat Sep 30 01:03:03 2000
190 +++ db-3.1.17/mutex/alphalinux.gcc Sat Sep 30 01:03:03 2000
194 + * Should return 0 if could not acquire the lock, 1 if lock was acquired
199 +MUTEX_SET(tsl_t *tsl) {
200 + register tsl_t *__l = tsl;
201 + unsigned long int __r;
202 + unsigned long int temp;
204 + ("1: ldl_l %0,%1\n"
215 + : "=&r" (temp), "=m" (*__l), "=&r" (__r)
216 + : "Ir" (1UL), "m" (*__l));
221 + * Unset mutex. Judging by Alpha Architecture Handbook, the mb instruction
222 + * might be necessary before unlocking
225 +MUTEX_UNSET(tsl_t *tsl) {
226 + asm volatile(" mb\n");
232 +#include <alpha/builtins.h>
233 +#define MUTEX_SET(tsl) (__LOCK_LONG_RETRY((tsl), 1) != 0)
234 +#define MUTEX_UNSET(tsl) (*(tsl) = 0)
237 +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl)