about summary refs log tree commit diff
path: root/ports/sysdeps/mips
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim@codesourcery.com>2012-08-15 16:29:06 -0700
committerMaxim Kuvyrkov <maxim@codesourcery.com>2012-08-15 16:29:06 -0700
commitef4009734b84903615be28b38638c166e5455692 (patch)
tree93062b1f67b1c46ffa1c0cf35f882623ec7aeb39 /ports/sysdeps/mips
parent329bc0186823da075e1a41aab9a4cdc78fb858aa (diff)
downloadglibc-ef4009734b84903615be28b38638c166e5455692.tar.gz
glibc-ef4009734b84903615be28b38638c166e5455692.tar.xz
glibc-ef4009734b84903615be28b38638c166e5455692.zip
Add generic versions of pthread_spin_lock and pthread_spin_trylock.
Diffstat (limited to 'ports/sysdeps/mips')
-rw-r--r--ports/sysdeps/mips/nptl/pthread_spin_lock.c (renamed from ports/sysdeps/mips/nptl/pthread_spin_lock.S)25
-rw-r--r--ports/sysdeps/mips/nptl/pthread_spin_trylock.S40
2 files changed, 6 insertions, 59 deletions
diff --git a/ports/sysdeps/mips/nptl/pthread_spin_lock.S b/ports/sysdeps/mips/nptl/pthread_spin_lock.c
index a8504f1636..f39b0182bc 100644
--- a/ports/sysdeps/mips/nptl/pthread_spin_lock.S
+++ b/ports/sysdeps/mips/nptl/pthread_spin_lock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,22 +15,9 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/asm.h>
-#include <sysdep.h>
-#include <sgidefs.h>
+#define SPIN_LOCK_READS_BETWEEN_CMPXCHG 1000
 
-ENTRY (pthread_spin_lock)
-	.set	push
-#if _MIPS_SIM == _ABIO32
-	.set	mips2
-#endif
-1:	ll	a2, 0(a0)
-	li	a1, 1
-	bnez	a2, 1b
-	sc	a1, 0(a0)
-	beqz	a1, 1b
-	MIPS_SYNC
-	.set	pop
-	li	v0, 0
-	ret
-PSEUDO_END (pthread_spin_lock)
+/* We can't use the normal "#include <nptl/pthread_spin_lock.c>" because
+   it will resolve to this very file.  Using "sysdeps/.." as reference to the
+   top level directory does the job.  */
+#include <sysdeps/../nptl/pthread_spin_lock.c>
diff --git a/ports/sysdeps/mips/nptl/pthread_spin_trylock.S b/ports/sysdeps/mips/nptl/pthread_spin_trylock.S
deleted file mode 100644
index 95b55c3d4e..0000000000
--- a/ports/sysdeps/mips/nptl/pthread_spin_trylock.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/asm.h>
-#include <sysdep.h>
-#define _ERRNO_H 1
-#include <bits/errno.h>
-#include <sgidefs.h>
-
-ENTRY (pthread_spin_trylock)
-	.set	push
-#if _MIPS_SIM == _ABIO32
-	.set	mips2
-#endif
-	ll	a2, 0(a0)
-	li	a1, 1
-	bnez	a2, 1f
-	sc	a1, 0(a0)
-	beqz	a1, 1f
-	MIPS_SYNC
-	.set	pop
-	li	v0, 0
-	ret
-1:	li	v0, EBUSY
-	ret
-PSEUDO_END (pthread_spin_trylock)