summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/pulseaudio/libatomics-ops/gentoo/libatomic_ops-1.2-mips.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-multimedia/pulseaudio/libatomics-ops/gentoo/libatomic_ops-1.2-mips.patch')
-rw-r--r--meta/recipes-multimedia/pulseaudio/libatomics-ops/gentoo/libatomic_ops-1.2-mips.patch125
1 files changed, 125 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/pulseaudio/libatomics-ops/gentoo/libatomic_ops-1.2-mips.patch b/meta/recipes-multimedia/pulseaudio/libatomics-ops/gentoo/libatomic_ops-1.2-mips.patch
new file mode 100644
index 0000000000..29f07b9f99
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/libatomics-ops/gentoo/libatomic_ops-1.2-mips.patch
@@ -0,0 +1,125 @@
1# Patch copied from the OpenEmbedded libatomics-ops recipe. Original
2# source was from Gentoo.
3#
4# Signed-off-by: Scott Garman <scott.a.garman@intel.com>
5diff --git a/src/atomic_ops.h b/src/atomic_ops.h
6index c23f30b..791b360 100755
7--- a/src/atomic_ops.h
8+++ b/src/atomic_ops.h
9@@ -220,6 +220,9 @@
10 # if defined(__cris__) || defined(CRIS)
11 # include "atomic_ops/sysdeps/gcc/cris.h"
12 # endif
13+# if defined(__mips__)
14+# include "atomic_ops/sysdeps/gcc/mips.h"
15+# endif
16 #endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
17
18 #if defined(__INTEL_COMPILER) && !defined(AO_USE_PTHREAD_DEFS)
19diff --git a/src/atomic_ops/sysdeps/Makefile.am b/src/atomic_ops/sysdeps/Makefile.am
20index 74122b4..d6737c0 100644
21--- a/src/atomic_ops/sysdeps/Makefile.am
22+++ b/src/atomic_ops/sysdeps/Makefile.am
23@@ -29,6 +29,7 @@ nobase_sysdep_HEADERS= generic_pthread.h \
24 gcc/powerpc.h gcc/sparc.h \
25 gcc/hppa.h gcc/m68k.h gcc/s390.h \
26 gcc/ia64.h gcc/x86_64.h gcc/cris.h \
27+ gcc/mips.h \
28 \
29 icc/ia64.h \
30 \
31diff --git a/src/atomic_ops/sysdeps/gcc/mips.h b/src/atomic_ops/sysdeps/gcc/mips.h
32new file mode 100644
33index 0000000..e7f3a5d
34--- /dev/null
35+++ b/src/atomic_ops/sysdeps/gcc/mips.h
36@@ -0,0 +1,89 @@
37+/*
38+ * Copyright (c) 2005 Thiemo Seufer <ths@networkno.de>
39+ * Copyright (c) 2007 Zhang Le <r0bertz@gentoo.org>
40+ *
41+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
42+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
43+ *
44+ * Permission is hereby granted to use or copy this program
45+ * for any purpose, provided the above notices are retained on all copies.
46+ * Permission to modify the code and to distribute modified code is granted,
47+ * provided the above notices are retained, and a notice that the code was
48+ * modified is included with the above copyright notice.
49+ */
50+
51+#include "../all_aligned_atomic_load_store.h"
52+#include "../test_and_set_t_is_ao_t.h"
53+
54+/* Data dependence does not imply read ordering. */
55+#define AO_NO_DD_ORDERING
56+
57+AO_INLINE void
58+AO_nop_full()
59+{
60+ __asm__ __volatile__(
61+ " .set push \n"
62+ " .set mips3 \n"
63+ " .set noreorder \n"
64+ " .set nomacro \n"
65+ " sync \n"
66+ " .set pop "
67+ : : : "memory");
68+}
69+
70+#define AO_HAVE_nop_full
71+
72+AO_INLINE int
73+AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val)
74+{
75+ register int was_equal = 0;
76+ register int temp;
77+
78+ __asm__ __volatile__(
79+ " .set push \n"
80+ " .set mips3 \n"
81+ " .set noreorder \n"
82+ " .set nomacro \n"
83+ "1: ll %0, %1 \n"
84+ " bne %0, %4, 2f \n"
85+ " move %0, %3 \n"
86+ " sc %0, %1 \n"
87+ " .set pop \n"
88+ " beqz %0, 1b \n"
89+ " li %2, 1 \n"
90+ "2: "
91+ : "=&r" (temp), "+R" (*addr), "+r" (was_equal)
92+ : "r" (new_val), "r" (old)
93+ : "memory");
94+ return was_equal;
95+}
96+
97+#define AO_HAVE_compare_and_swap
98+
99+AO_INLINE AO_t
100+AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
101+{
102+ AO_t result, temp;
103+ __asm__ __volatile__(
104+ " .set push \n"
105+ " .set mips3 \n"
106+ " .set noreorder \n"
107+ " .set nomacro \n"
108+ "1: ll %1, %2 \n"
109+ " addu %0, %1, %3 \n"
110+ " sc %0, %2 \n"
111+ " beqz %0, 1b \n"
112+ " addu %0, %1, %3 \n"
113+ " sync \n"
114+ " .set pop \n"
115+ : "=&r" (result), "=&r" (temp), "=m" (*p)
116+ : "r" (incr), "m" (*p)
117+ : "memory");
118+ return result;
119+}
120+
121+#define AO_HAVE_fetch_and_add_full
122+
123+/*
124+ * FIXME: fetch_and_add_full implemented, any others?
125+ */