This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Mirror i386 change on sparc: 'Avoid "anonymous" code inpthread_spin_lock'


Tested on sparc{,v9,64}-linux-gnu and committed to master.

nptl/

	* sysdeps/sparc/sparc64/pthread_spin_lock.S: New.
	* sysdeps/sparc/sparc64/pthread_spin_lock.c: Delete.
	* sysdeps/sparc/sparc64/pthread_spin_unlock.S: New.
	* sysdeps/sparc/sparc64/pthread_spin_unlock.c: Delete.
	* sysdeps/sparc/sparc64/pthread_spin_trylock.S: New.
	* sysdeps/sparc/sparc64/pthread_spin_trylock.c: Delete.
	* sysdeps/sparc/sparc64/pthread_spin_init.c: New.
	* sysdeps/sparc/sparc32/pthread_spin_lock.S: New.
	* sysdeps/sparc/sparc32/pthread_spin_lock.c: Delete.
	* sysdeps/sparc/sparc32/pthread_spin_trylock.S: New.
	* sysdeps/sparc/sparc32/pthread_spin_trylock.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.S: New.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.S: New.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.S: New.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_init.c: New.
---
 nptl/ChangeLog                                     |   21 +++++++++++
 nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S     |   32 ++++++++++++++++
 nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c     |   39 --------------------
 nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.S  |   29 +++++++++++++++
 nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c  |   28 --------------
 .../sparc/sparc32/sparcv9/pthread_spin_init.c      |    1 +
 .../sparc/sparc32/sparcv9/pthread_spin_lock.S      |    1 +
 .../sparc/sparc32/sparcv9/pthread_spin_lock.c      |   38 -------------------
 .../sparc/sparc32/sparcv9/pthread_spin_trylock.S   |    1 +
 .../sparc/sparc32/sparcv9/pthread_spin_trylock.c   |    1 -
 .../sparc/sparc32/sparcv9/pthread_spin_unlock.S    |    1 +
 .../sparc/sparc32/sparcv9/pthread_spin_unlock.c    |    1 -
 nptl/sysdeps/sparc/sparc64/pthread_spin_init.c     |    1 +
 nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S     |   31 ++++++++++++++++
 nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c     |   38 -------------------
 nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.S  |   27 ++++++++++++++
 nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c  |   33 -----------------
 nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.S   |   27 ++++++++++++++
 nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c   |   29 ---------------
 19 files changed, 172 insertions(+), 207 deletions(-)
 create mode 100644 nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
 delete mode 100644 nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c
 create mode 100644 nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.S
 delete mode 100644 nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c
 create mode 100644 nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_init.c
 create mode 100644 nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.S
 delete mode 100644 nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c
 create mode 100644 nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.S
 delete mode 100644 nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c
 create mode 100644 nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.S
 delete mode 100644 nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c
 create mode 100644 nptl/sysdeps/sparc/sparc64/pthread_spin_init.c
 create mode 100644 nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
 delete mode 100644 nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c
 create mode 100644 nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.S
 delete mode 100644 nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c
 create mode 100644 nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.S
 delete mode 100644 nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c

diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 4d917bc..ad47d67 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,24 @@
+2012-05-02  David S. Miller  <davem@davemloft.net>
+
+	* sysdeps/sparc/sparc64/pthread_spin_lock.S: New.
+	* sysdeps/sparc/sparc64/pthread_spin_lock.c: Delete.
+	* sysdeps/sparc/sparc64/pthread_spin_unlock.S: New.
+	* sysdeps/sparc/sparc64/pthread_spin_unlock.c: Delete.
+	* sysdeps/sparc/sparc64/pthread_spin_trylock.S: New.
+	* sysdeps/sparc/sparc64/pthread_spin_trylock.c: Delete.
+	* sysdeps/sparc/sparc64/pthread_spin_init.c: New.
+	* sysdeps/sparc/sparc32/pthread_spin_lock.S: New.
+	* sysdeps/sparc/sparc32/pthread_spin_lock.c: Delete.
+	* sysdeps/sparc/sparc32/pthread_spin_trylock.S: New.
+	* sysdeps/sparc/sparc32/pthread_spin_trylock.c: Delete.
+	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.S: New.
+	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c: Delete.
+	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.S: New.
+	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c: Delete.
+	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.S: New.
+	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c: Delete.
+	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_init.c: New.
+
 2012-05-02  Allan McRae  <allan@archlinux.org>
 
 	* Makefile: (LDFLAGS-tst-tls5): Use $(no-as-needed).
diff --git a/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S b/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
new file mode 100644
index 0000000..db4a7b1
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
@@ -0,0 +1,32 @@
+/* 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
+   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 <sysdep.h>
+
+	.text
+ENTRY(pthread_spin_lock)
+	ldstub		[%o0], %g1
+	orcc		%g1, 0x0, %g0
+	bne,a		2f
+	 ldub		[%o0], %g1
+1:	retl
+	 mov		0, %o0
+2:	orcc		%g1, 0x0, %g0
+	bne,a		2b
+	 ldub		[%o0], %g1
+	ba,a,pt		%xcc, 1b
+END(pthread_spin_lock)
\ No newline at end of file
diff --git a/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c b/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c
deleted file mode 100644
index a5d3d2f..0000000
--- a/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
-
-   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 "pthreadP.h"
-
-int
-pthread_spin_lock (pthread_spinlock_t *lock)
-{
-  __asm __volatile
-    ("1: ldstub [%0], %%g2\n"
-     "   orcc   %%g2, 0x0, %%g0\n"
-     "   bne,a  2f\n"
-     "   ldub   [%0], %%g2\n"
-     ".subsection 2\n"
-     "2: orcc   %%g2, 0x0, %%g0\n"
-     "   bne,a  2b\n"
-     "   ldub   [%0], %%g2\n"
-     "   b,a    1b\n"
-     ".previous"
-     : /* no outputs */
-     : "r" (lock)
-     : "g2", "memory", "cc");
-  return 0;
-}
diff --git a/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.S b/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.S
new file mode 100644
index 0000000..487a681
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.S
@@ -0,0 +1,29 @@
+/* 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
+   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 <sysdep.h>
+#include <pthread-errnos.h>
+
+	.text
+ENTRY(pthread_spin_trylock)
+	ldstub		[%o0], %o0
+	cmp		%o0, 0
+	bne,a		1f
+	 mov		EBUSY, %o0
+1:	retl
+	 nop
+END(pthread_spin_trylock)
diff --git a/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c b/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c
deleted file mode 100644
index 884c207..0000000
--- a/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
-
-   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 <errno.h>
-#include "pthreadP.h"
-
-int
-pthread_spin_trylock (pthread_spinlock_t *lock)
-{
-  int res;
-  __asm __volatile ("ldstub [%1], %0" : "=r" (res) : "r" (lock) : "memory");
-  return res == 0 ? 0 : EBUSY;
-}
diff --git a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_init.c b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_init.c
new file mode 100644
index 0000000..d27e550
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_init.c
@@ -0,0 +1 @@
+#include <sparc64/pthread_spin_init.c>
diff --git a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.S b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.S
new file mode 100644
index 0000000..7d7875c
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.S
@@ -0,0 +1 @@
+#include <sparc64/pthread_spin_lock.S>
\ No newline at end of file
diff --git a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c
deleted file mode 100644
index 1dff0c1..0000000
--- a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
-
-   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 "pthreadP.h"
-
-int
-pthread_spin_lock (pthread_spinlock_t *lock)
-{
-  __asm __volatile
-    ("1: ldstub  [%0], %%g2\n"
-     "   brnz,pn %%g2, 2f\n"
-     "    membar #StoreLoad | #StoreStore\n"
-     ".subsection 2\n"
-     "2: ldub    [%0], %%g2\n"
-     "   brnz,pt %%g2, 2b\n"
-     "    membar #LoadLoad\n"
-     "   b,a,pt  %%xcc, 1b\n"
-     ".previous"
-     : /* no outputs */
-     : "r" (lock)
-     : "g2", "memory");
-  return 0;
-}
diff --git a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.S b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.S
new file mode 100644
index 0000000..af5b151
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.S
@@ -0,0 +1 @@
+#include <sparc64/pthread_spin_trylock.S>
diff --git a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c
deleted file mode 100644
index 3b20a21..0000000
--- a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sparc64/pthread_spin_trylock.c>
diff --git a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.S b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.S
new file mode 100644
index 0000000..c40d80f
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.S
@@ -0,0 +1 @@
+#include <sparc64/pthread_spin_unlock.S>
diff --git a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c b/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c
deleted file mode 100644
index 482cbe3..0000000
--- a/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sparc64/pthread_spin_unlock.c>
diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_init.c b/nptl/sysdeps/sparc/sparc64/pthread_spin_init.c
new file mode 100644
index 0000000..58319ab
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_init.c
@@ -0,0 +1 @@
+/* pthread_spin_init is in pthread_spin_unlock.S */
diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
new file mode 100644
index 0000000..5e7b0fa
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
@@ -0,0 +1,31 @@
+/* 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
+   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 <sysdep.h>
+
+	.text
+ENTRY(pthread_spin_lock)
+	ldstub		[%o0], %g1
+	brnz,pn		%g1, 2f
+	 membar		#StoreLoad | #StoreStore
+1:	retl
+	 mov		0, %o0
+2:	ldub		[%o0], %g1
+	brnz,pt		%g1, 2b
+	 membar		#LoadLoad
+	ba,a,pt		%xcc, 1b
+END(pthread_spin_lock)
\ No newline at end of file
diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c
deleted file mode 100644
index e82053a..0000000
--- a/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
-
-   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 "pthreadP.h"
-
-int
-pthread_spin_lock (pthread_spinlock_t *lock)
-{
-  __asm __volatile
-    ("1: ldstub  [%0], %%g5\n"
-     "   brnz,pn %%g5, 2f\n"
-     "    membar #StoreLoad | #StoreStore\n"
-     ".subsection 2\n"
-     "2: ldub    [%0], %%g5\n"
-     "   brnz,pt %%g5, 2b\n"
-     "    membar #LoadLoad\n"
-     "   b,a,pt  %%xcc, 1b\n"
-     ".previous"
-     : /* no outputs */
-     : "r" (lock)
-     : "g5", "memory");
-  return 0;
-}
diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.S b/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.S
new file mode 100644
index 0000000..867b8b5
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.S
@@ -0,0 +1,27 @@
+/* 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
+   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 <sysdep.h>
+#include <pthread-errnos.h>
+
+	.text
+ENTRY(pthread_spin_trylock)
+	ldstub		[%o0], %o0
+	membar		#StoreLoad | #StoreStore
+	retl
+	 movrnz		%o0, EBUSY, %o0
+END(pthread_spin_trylock)
diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c b/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c
deleted file mode 100644
index 7bbfef6..0000000
--- a/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
-
-   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 <errno.h>
-#include "pthreadP.h"
-
-int
-pthread_spin_trylock (pthread_spinlock_t *lock)
-{
-  int res;
-  __asm __volatile
-    ("ldstub [%1], %0\n"
-     "membar #StoreLoad | #StoreStore"
-     : "=r" (res)
-     : "r" (lock)
-     : "memory");
-  return res == 0 ? 0 : EBUSY;
-}
diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.S b/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.S
new file mode 100644
index 0000000..e668c39
--- /dev/null
+++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.S
@@ -0,0 +1,27 @@
+/* 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
+   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 <sysdep.h>
+
+	.text
+ENTRY(pthread_spin_unlock)
+	membar		#StoreStore | #LoadStore
+	retl
+	 stb		%g0, [%o0]
+END(pthread_spin_unlock)
+
+strong_alias (pthread_spin_unlock, pthread_spin_init)
diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c b/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c
deleted file mode 100644
index cda16f9..0000000
--- a/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* pthread_spin_unlock -- unlock a spin lock.  Generic version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.
-
-   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 "pthreadP.h"
-#include <atomic.h>
-
-int
-pthread_spin_unlock (pthread_spinlock_t *lock)
-{
-  __asm __volatile ("membar #StoreStore | #LoadStore");
-  *lock = 0;
-  return 0;
-}
-- 
1.7.10


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]