[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#155244: SuperH mutex support



Package: db2
Version: 2:2.7.7.0-7
Severity: wishlist
Tags: patch

Hi,

I'm one of the Debian/sh porters (see http://debian.dodes.org/sh).
This report is Cc:-ed to debian-superh@lists.debian.org.

Could you please include this patch in the package to enable SuperH
specific mutex code?

diff -urN db-2.7.7/dist/config.hin db-2.7.7.new/dist/config.hin
--- db-2.7.7/dist/config.hin	Sun Jun 23 16:08:07 2002
+++ db-2.7.7.new/dist/config.hin	Sun Jun 23 16:03:02 2002
@@ -70,6 +70,9 @@
 /* Define if you want to use s390/gcc assembly spinlocks. */
 #undef HAVE_ASSEM_S390_GCC
 
+/* Define if you want to use sh/gcc assembly spinlocks. */
+#undef HAVE_ASSEM_SH_GCC
+
 /* Define if you have the AIX _check_lock spinlocks. */
 #undef HAVE_FUNC_AIX
 
diff -urN db-2.7.7/dist/configure.in db-2.7.7.new/dist/configure.in
--- db-2.7.7/dist/configure.in	Sun Jun 23 16:08:07 2002
+++ db-2.7.7.new/dist/configure.in	Sun Jun 23 16:06:30 2002
@@ -404,6 +404,17 @@
 exit(1);}], [db_cv_spinlocks=alpha/gcc])
 fi
 
+dnl: sh/gcc: Linux
+if test "$db_cv_spinlocks" = no; then
+AC_TRY_RUN([main(){
+#if defined(__sh__)
+#if defined(__GNUC__)
+exit(0);
+#endif
+#endif
+exit(1);}], [db_cv_spinlocks=sh/gcc])
+fi
+
 dnl: uts/cc: UTS
 if test "$db_cv_spinlocks" = no; then
 AC_TRY_RUN([main(){
@@ -505,6 +516,10 @@
 	AC_DEFINE(HAVE_ASSEM_ALPHA_GCC)
 	mutex_align="16"
 	spin_line1="typedef unsigned long tsl_t;";;
+sh/gcc)
+	AC_DEFINE(HAVE_ASSEM_SH_GCC)
+	mutex_align="1"
+	spin_line1="typedef unsigned char tsl_t;";;
 *)
 	mutex_align="1";;
 esac
diff -urN db-2.7.7/mutex/mutex.c db-2.7.7.new/mutex/mutex.c
--- db-2.7.7/mutex/mutex.c	Sun Jun 23 16:08:07 2002
+++ db-2.7.7.new/mutex/mutex.c	Sun Jun 23 16:03:02 2002
@@ -118,6 +118,10 @@
 #include "s390.gcc"
 #endif
 
+#ifdef HAVE_ASSEM_SH_GCC
+#include "sh.gcc"
+#endif
+
 #ifdef WIN16
 /* Win16 spinlocks are simple because we cannot possibly be preempted. */
 #define	TSL_INIT(tsl)
diff -urN db-2.7.7/mutex/sh.gcc db-2.7.7.new/mutex/sh.gcc
--- db-2.7.7/mutex/sh.gcc	Thu Jan  1 09:00:00 1970
+++ db-2.7.7.new/mutex/sh.gcc	Sun Jun 23 16:03:02 2002
@@ -0,0 +1,18 @@
+/*
+ * @(#)sh.gcc	1.0 (gniibe) 8/27/2001
+ *
+ * For gcc/sh, 0 is clear, 1 is set.
+ */
+#define	TSL_SET(tsl) ({							\
+	register tsl_t *__l = (tsl);					\
+	int __r;							\
+	asm volatile("tas.b	%1\n\t"					\
+		     "movt	%0"					\
+	    : "=r" (__r), "=m" (*__l)					\
+	    : "1" (*__l)						\
+	    : "t");							\
+	(__r & 1) == 0;							\
+})
+
+#define	TSL_UNSET(tsl)	(*(tsl) = 0)
+#define	TSL_INIT(tsl)	TSL_UNSET(tsl)

Regards,
--
YAEGASHI Takeshi <t@keshi.org> <takeshi@yaegashi.jp> <yaegashi@dodes.org>



Reply to: