[Pkg-db-devel] Bug#281059: db4.1: patch

Martin Zobel-Helas Martin Zobel-Helas <mhelas@helas.net>, 281059@bugs.debian.org
Sat, 8 Jan 2005 15:11:34 +0100


--aVD9QWMuhilNxW9f
Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G"
Content-Disposition: inline


--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

tags 281059 + patch
thanks

find attached a patch which was also used for db4.2 (slighty modified).
Seems to work fine for me.

Greetings
Martin
--
"Deep" is a word like "theory" or "semantic" -- it implies all sorts of
marvelous things.  It's one thing to be able to say "I've got a theory",
quite another to say "I've got a semantic theory", but, ah, those who can
claim "I've got a deep semantic theory", they are truly blessed.
		-- Randy Davis

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="db4.1-mutex.patch"
Content-Transfer-Encoding: quoted-printable

diff -rNu db4.1-4.1.25/dbinc/mutex.h db4.1-4.1.25.new/dbinc/mutex.h
--- db4.1-4.1.25/dbinc/mutex.h	2002-12-19 16:39:08.000000000 +0000
+++ db4.1-4.1.25.new/dbinc/mutex.h	2005-01-08 05:09:51.000000000 +0000
@@ -463,6 +463,48 @@
 #endif
=20
 /*********************************************************************
+ * MIPS/gcc assembly.
+ *********************************************************************/
+#ifdef HAVE_MUTEX_MIPS_GCC_ASSEMBLY
+typedef u_int32_t tsl_t;
+
+#ifndef        MUTEX_ALIGN
+#define        MUTEX_ALIGN     4
+#endif
+
+#ifdef LOAD_ACTUAL_MUTEX_CODE
+/*
+ * For gcc/mips.  Should return 0 if could not acquire the lock, 1 if
+ * lock was acquired properly.
+ */
+static inline int
+MUTEX_SET(tsl_t *tsl) {
+       register tsl_t *__l =3D tsl;
+       register tsl_t __r;
+       asm volatile(
+               "       .set push       \n"
+               "       .set mips2      \n"
+               "       .set noreorder  \n"
+               "1:     ll      %0, %1  \n"
+               "       bnez    %0, 1f  \n"
+               "        nop            \n"
+               "       addu    %0, 1   \n"
+               "       sc      %0, %1  \n"
+               "       beqz    %0, 1b  \n"
+               "        move   %0, $0  \n"
+               "       sync            \n"
+               "1:     .set pop        \n"
+               : "=3D&r" (__r), "+m" (*__l)
+               : : "memory");
+       return __r ^ 1;
+}
+
+#define        MUTEX_UNSET(tsl)        (*(volatile tsl_t *)(tsl) =3D 0)
+#define        MUTEX_INIT(tsl)         MUTEX_UNSET(tsl)
+#endif
+#endif
+
+/*********************************************************************
  * PowerPC/gcc assembly.
  *********************************************************************/
 #if defined(HAVE_MUTEX_PPC_GENERIC_GCC_ASSEMBLY) ||			\
diff -rNu db4.1-4.1.25/debian/changelog db4.1-4.1.25.new/debian/changelog
--- db4.1-4.1.25/debian/changelog	2005-01-08 13:09:02.000000000 +0000
+++ db4.1-4.1.25.new/debian/changelog	2005-01-08 05:24:47.000000000 +0000
@@ -1,3 +1,11 @@
+db4.1 (4.1.25-17.1) unstable; urgency=3Dlow
+
+  * NMU (BSP)
+  * Adding mutex-support for mips, backported from db4.2
+    Closes: #281059:
+
+ -- Martin Zobel-Helas <zobel@sigrun.fnb.maschinenbau.tu-darmstadt.de>  Sa=
t,  8 Jan 2005 05:23:55 +0000
+
 db4.1 (4.1.25-17) unstable; urgency=3Dlow
=20
   * Version gcj build-dep so woody backporters will have to
diff -rNu db4.1-4.1.25/dist/aclocal/mutex.ac db4.1-4.1.25.new/dist/aclocal/=
mutex.ac
--- db4.1-4.1.25/dist/aclocal/mutex.ac	2002-07-31 19:19:20.000000000 +0000
+++ db4.1-4.1.25.new/dist/aclocal/mutex.ac	2005-01-08 05:14:18.000000000 +0=
000
@@ -349,6 +349,17 @@
 ], [db_cv_mutex=3D"ARM/gcc-assembly"])
 fi
=20
+# MIPS/gcc: Linux
+if test "$db_cv_mutex" =3D no; then
+AC_TRY_COMPILE(,[
+#if defined(__mips__) && defined(__GNUC__)
+       exit(0);
+#else
+       FAIL TO COMPILE/LINK
+#endif
+], [db_cv_mutex=3D"MIPS/gcc-assembly"])
+fi
+
 # PaRisc/gcc: HP/UX
 if test "$db_cv_mutex" =3D no; then
 AC_TRY_COMPILE(,[
@@ -470,6 +481,10 @@
 			AC_DEFINE(HAVE_MUTEX_ARM_GCC_ASSEMBLY)
 			AH_TEMPLATE(HAVE_MUTEX_ARM_GCC_ASSEMBLY,
 			    [Define to 1 to use the GCC compiler and ARM assembly language mute=
xes.]);;
+MIPS/gcc-assembly)	ADDITIONAL_OBJS=3D"mut_tas${o} $ADDITIONAL_OBJS"
+			AC_DEFINE(HAVE_MUTEX_MIPS_GCC_ASSEMBLY)
+			AH_TEMPLATE(HAVE_MUTEX_MIPS_GCC_ASSEMBLY,
+			    [Define to 1 to use the GCC compiler and MIPS assembly language mut=
exes.]);;
 HP/msem_init)		ADDITIONAL_OBJS=3D"mut_tas${o} $ADDITIONAL_OBJS"
 			AC_DEFINE(HAVE_MUTEX_HPPA_MSEM_INIT)
 			AH_TEMPLATE(HAVE_MUTEX_HPPA_MSEM_INIT,
diff -rNu db4.1-4.1.25/dist/config.hin db4.1-4.1.25.new/dist/config.hin
--- db4.1-4.1.25/dist/config.hin	2002-09-13 22:15:27.000000000 +0000
+++ db4.1-4.1.25.new/dist/config.hin	2005-01-08 05:17:04.000000000 +0000
@@ -94,6 +94,9 @@
 /* Define to 1 to use the GCC compiler and ARM assembly language mutexes. =
*/
 #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY
=20
+/* Define to 1 to use the GCC compiler and MIPS assembly language mutexes.=
 */
+#undef HAVE_MUTEX_MIPS_GCC_ASSEMBLY
+
 /* Define to 1 to use the UNIX fcntl system call mutexes. */
 #undef HAVE_MUTEX_FCNTL
=20

--k1lZvvs/B4yU6o8G--

--aVD9QWMuhilNxW9f
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFB3+oVhfE0hPpPRbwRAsnVAJ9u8Aqh1jGA1sFE5rwe5MaP7oM+YACeIZvG
trn6Ww592o3TQIV8Mi6GhIc=
=3MAz
-----END PGP SIGNATURE-----

--aVD9QWMuhilNxW9f--