summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads/sysdeps/mips/pt-machine.h
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-05-18 18:41:24 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-05-18 18:41:24 +0200
commit6a8ccc95528f5e86a8770ed15ce89609b5b3dee9 (patch)
treebbd4df35b4d4a6a8b00d7a5e61fb2668b850ad62 /libpthread/linuxthreads/sysdeps/mips/pt-machine.h
parent398a27a5b323956344b4f831d892fed3bd9813c7 (diff)
remove linuxthreads.new, rename linuxthreads.old
Linuxthreads.new isn't really useful with the existence of NPTL/TLS for well supported architectures. There is no reason to use LT.new for ARM/MIPS or other architectures supporting NPTL/TLS. It is not available for noMMU architectures like Blackfin or FR-V. To simplify the live of the few uClibc-ng developers, LT.new is removed and LT.old is renamed to LT. LINUXTHREADS_OLD -> UCLIBC_HAS_LINUXTHREADS
Diffstat (limited to 'libpthread/linuxthreads/sysdeps/mips/pt-machine.h')
-rw-r--r--libpthread/linuxthreads/sysdeps/mips/pt-machine.h41
1 files changed, 29 insertions, 12 deletions
diff --git a/libpthread/linuxthreads/sysdeps/mips/pt-machine.h b/libpthread/linuxthreads/sysdeps/mips/pt-machine.h
index 74e8807eb..caaf9a7c0 100644
--- a/libpthread/linuxthreads/sysdeps/mips/pt-machine.h
+++ b/libpthread/linuxthreads/sysdeps/mips/pt-machine.h
@@ -24,13 +24,40 @@
#define _PT_MACHINE_H 1
#include <features.h>
-#include <sgidefs.h>
-#include <sys/tas.h>
#ifndef PT_EI
# define PT_EI __extern_always_inline
#endif
+/* 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
+__NTH (_test_and_set (int *p, int v))
+{
+ 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;
+}
+
+
/* Spinlock implementation; required. */
PT_EI long int
@@ -58,22 +85,12 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
("/* Inline compare & swap */\n"
"1:\n\t"
".set push\n\t"
-#if _MIPS_SIM == _ABIO32
".set mips2\n\t"
-#endif
-#if _MIPS_SIM == _ABI64
- "lld %1,%5\n\t"
-#else
"ll %1,%5\n\t"
-#endif
"move %0,$0\n\t"
"bne %1,%3,2f\n\t"
"move %0,%4\n\t"
-#if _MIPS_SIM == _ABI64
- "scd %0,%2\n\t"
-#else
"sc %0,%2\n\t"
-#endif
".set pop\n\t"
"beqz %0,1b\n"
"2:\n\t"