summaryrefslogtreecommitdiffstats
path: root/libpthread/linuxthreads
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-02-28 08:20:00 +0000
committerEric Andersen <andersen@codepoet.org>2003-02-28 08:20:00 +0000
commita18fa6f911e4c796fcd6bd34922e471704755bea (patch)
tree98a470e8739fd901bf9c84eb503d78d81d9cd193 /libpthread/linuxthreads
parent7988cf3664da108df037162271596660b4076c6b (diff)
downloaduClibc-alpine-a18fa6f911e4c796fcd6bd34922e471704755bea.tar.bz2
uClibc-alpine-a18fa6f911e4c796fcd6bd34922e471704755bea.tar.xz
Fixup mips pthreads
Diffstat (limited to 'libpthread/linuxthreads')
-rw-r--r--libpthread/linuxthreads/sysdeps/mips/pt-machine.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/libpthread/linuxthreads/sysdeps/mips/pt-machine.h b/libpthread/linuxthreads/sysdeps/mips/pt-machine.h
index 59d26740f..93d862774 100644
--- a/libpthread/linuxthreads/sysdeps/mips/pt-machine.h
+++ b/libpthread/linuxthreads/sysdeps/mips/pt-machine.h
@@ -23,7 +23,36 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
-#include <sys/tas.h>
+#include <features.h>
+
+/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000. */
+static inline int
+_test_and_set (int *p, int v) __THROW
+{
+ int r, t;
+
+ __asm__ __volatile__
+ ("/* Inline test and set */\n"
+ "1:\n\t"
+ ".set push\n\t"
+ ".set mips2\n\t"
+ "ll %0,%3\n\t"
+ "move %1,%4\n\t"
+ "beq %0,%4,2f\n\t"
+ "sc %1,%2\n\t"
+ ".set pop\n\t"
+ "beqz %1,1b\n"
+ "2:\n\t"
+ "/* End test and set */"
+ : "=&r" (r), "=&r" (t), "=m" (*p)
+ : "m" (*p), "r" (v)
+ : "memory");
+
+ return r;
+}
+
#ifndef PT_EI
# define PT_EI extern inline