Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 30 Aug 1999 21:51:29 +0000 (21:51 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 30 Aug 1999 21:51:29 +0000 (21:51 +0000)
* db2/db_int.h: Change tsl_t type to u_int32_t.
* db2/mutex/mutex.c: Allow Alpha mutex definitions.
* db2/mutex/alpha.h: New file.
* db2/mutex/sparc.gcc: Fix store code for v9.  Simplify clear code.
* sysdeps/alpha/Makefile [db2]: Set CFLAGS of mutex.c to make spinlocks
known.
Patches by Richard Henderson.

ChangeLog
db2/db_int.h
db2/mutex/alpha.h [new file with mode: 0644]
db2/mutex/mutex.c
db2/mutex/sparc.gcc
sysdeps/alpha/Makefile
timezone/test-tz.c

index e7cb403c6755301df4791970fc6fe21d45fc02e0..992ec54fbe62d751a30ace6c5a21d8cb1097de77 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 1999-08-30  Ulrich Drepper  <drepper@cygnus.com>
 
+       * db2/db_int.h: Change tsl_t type to u_int32_t.
+       * db2/mutex/mutex.c: Allow Alpha mutex definitions.
+       * db2/mutex/alpha.h: New file.
+       * db2/mutex/sparc.gcc: Fix store code for v9.  Simplify clear code.
+       * sysdeps/alpha/Makefile [db2]: Set CFLAGS of mutex.c to make spinlocks
+       known.
+       Patches by Richard Henderson.
+
        * stdlib/tst-environ.c: Add cast to avoid warning.
        * timezone/test-tz.c: Use setenv instead of putenv.
 
index 4c2e794153902236d79acd810b2748660db970f5..228c7ab4f27b5194a0da13b91d525e3f1bd639d7 100644 (file)
@@ -138,7 +138,7 @@ typedef struct __fn {
 /*******************************************************
  * Mutex support.
  *******************************************************/
-typedef unsigned char tsl_t;
+typedef u_int32_t tsl_t;
 
 /*
  * !!!
diff --git a/db2/mutex/alpha.h b/db2/mutex/alpha.h
new file mode 100644 (file)
index 0000000..ad3afc4
--- /dev/null
@@ -0,0 +1,26 @@
+/* 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)
index acc6aa07c9e649d6ea7de071f45d624f2e9b17df..2fac14cf3daa1b742a1771154bdc5f85d65c1b64 100644 (file)
@@ -110,6 +110,10 @@ static const char sccsid[] = "@(#)mutex.c  10.52 (Sleepycat) 11/8/98";
 #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)
index 8445a0629b3a444e3663d1d0344539b58c58bad5..9e3239b0b0ec0d0aa5ba3a246587ecdb6fa0d6cc 100644 (file)
  * For gcc/sparc, 0 is clear, 1 is set.
  */
 
-#if defined(__sparcv9__)
-Does the following code need membar instructions for V9 processors?
-#endif
+/* 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"                                           \
+           ("ldstub [%1],%0; stbar"                                    \
            : "=r"( __r) : "r" (__l));                                  \
        !__r;                                                           \
 })
 
-#define        TSL_UNSET(tsl) ({                                               \
-         register tsl_t *__l = (tsl);                                  \
-        __asm__ volatile ("stb %%g0,[%0]" : : "r" (__l));              \
-})
+#define        TSL_UNSET(tsl)  ((tsl) = 0)
 #define        TSL_INIT(tsl)   TSL_UNSET(tsl)
index 250a31779c295d212daf35e2757b338c111df814..63c7d4bba0c87dbf97d3dc637457ee1f5aa5c2bc 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1993, 94, 95, 96, 97, 99 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Brendan Kehoe (brendan@zen.org).
 
 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
+ifeq ($(subdir),db2)
+CPPFLAGS += -DHAVE_SPINLOCKS=1 -DHAVE_ASSEM_ALPHA=1
+endif
+
 ifeq ($(subdir),gmon)
 sysdep_routines += _mcount
 endif
index 28e1e37010d312b6b881a3258d6e78ecf54de01e..af37d8ae6aa6b1dca1472f599bd2bfa1198937d9 100644 (file)
@@ -34,7 +34,7 @@ main (int argc, char ** argv)
 
   for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
     {
-      setenv ("TZ", tests[i].env);
+      setenv ("TZ", tests[i].env, 1);
       t = mktime (&tm);
       if (t != tests[i].expected)
        {