Package: libatomic-ops
Version: 1.0-3
Tags: patch
Libatomic-ops currently FTBFS on mips/mipsel because there is no
arch-specific implementation, and the generic pthread isn't configured.
The appended patch adds a basic implementation for linux.
Thiemo
--- libatomic-ops-1.0.away/src/atomic_ops/sysdeps/Makefile.am 2005-08-03
02:05:18.000000000 +0200
+++ libatomic-ops-1.0/src/atomic_ops/sysdeps/Makefile.am 2005-10-27
20:59:59.000000000 +0200
@@ -26,7 +26,7 @@ nobase_sysdep_HEADERS= generic_pthread.h
gcc/alpha.h gcc/arm.h gcc/x86.h \
gcc/hppa.h gcc/ia64.h \
gcc/powerpc.h gcc/sparc.h \
- gcc/hppa.h gcc/m68k.h gcc/s390.h \
+ gcc/hppa.h gcc/m68k.h gcc/mips.h gcc/s390.h \
gcc/ia64.h gcc/x86_64.h gcc/cris.h \
\
icc/ia64.h \
--- libatomic-ops-1.0.away/src/atomic_ops/sysdeps/gcc/mips.h 1970-01-01
01:00:00.000000000 +0100
+++ libatomic-ops-1.0/src/atomic_ops/sysdeps/gcc/mips.h 2005-10-28
00:11:19.000000000 +0200
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2005 Thiemo Seufer <[EMAIL PROTECTED]>
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#include "../all_aligned_atomic_load_store.h"
+#include "../test_and_set_t_is_ao_t.h"
+
+/* Data dependence does not imply read ordering. */
+#define AO_NO_DD_ORDERING
+
+AO_INLINE void
+AO_nop_full()
+{
+ __asm__ __volatile__(
+ " .set push \n"
+ " .set mips2 \n"
+ " .set noreorder \n"
+ " .set nomacro \n"
+ " sync \n"
+ " .set pop "
+ : : : "memory");
+}
+
+#define AO_HAVE_nop_full
+
+AO_INLINE int
+AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val)
+{
+ register int was_equal = 0;
+ register int temp;
+
+ __asm__ __volatile__(
+ " .set push \n"
+ " .set mips2 \n"
+ " .set noreorder \n"
+ " .set nomacro \n"
+ "1: ll %0, %1 \n"
+ " bne %0, %4, 2f \n"
+ " move %0, %3 \n"
+ " sc %0, %1 \n"
+ " .set pop \n"
+ " beqz %0, 1b \n"
+ " li %2, 1 \n"
+ "2: "
+ : "=&r" (temp), "+R" (*addr), "+r" (was_equal)
+ : "r" (new_val), "r" (old)
+ : "memory");
+ return was_equal;
+}
+
+#define AO_HAVE_compare_and_swap
+
+/*
+ * FIXME: We should also implement fetch_and_add and or primitives
+ * directly.
+ */
--- libatomic-ops-1.0.away/src/atomic_ops.h 2005-08-03 02:05:18.000000000
+0200
+++ libatomic-ops-1.0/src/atomic_ops.h 2005-10-27 21:01:29.000000000 +0200
@@ -219,6 +219,9 @@
# if defined(__cris__) || defined(CRIS)
# include "atomic_ops/sysdeps/gcc/cris.h"
# endif
+# if defined(__mips__)
+# include "atomic_ops/sysdeps/gcc/mips.h"
+# endif /* __mips__ */
#endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
#if defined(__INTEL_COMPILER) && !defined(AO_USE_PTHREAD_DEFS)
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]