diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-02 19:04:54 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-02 19:04:54 -0700 |
commit | e2dbf201abdfa13fc4035a1a8888ecec91bef44c (patch) | |
tree | e9650172c9fa43e030a66b18b35d205bbac2ef38 /nptl/sysdeps/sparc/sparc64 | |
parent | d4c2917fc5091dae7ab1b30c165becb70d3c3453 (diff) | |
download | glibc-e2dbf201abdfa13fc4035a1a8888ecec91bef44c.tar.gz glibc-e2dbf201abdfa13fc4035a1a8888ecec91bef44c.tar.xz glibc-e2dbf201abdfa13fc4035a1a8888ecec91bef44c.zip |
Mirror i386 change on sparc: 'Avoid "anonymous" code in pthread_spin_lock'
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.
Diffstat (limited to 'nptl/sysdeps/sparc/sparc64')
-rw-r--r-- | nptl/sysdeps/sparc/sparc64/pthread_spin_init.c | 1 | ||||
-rw-r--r-- | nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S (renamed from nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c) | 26 | ||||
-rw-r--r-- | nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.S (renamed from nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c) | 26 | ||||
-rw-r--r-- | nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.S (renamed from nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c) | 31 |
4 files changed, 35 insertions, 49 deletions
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 0000000000..58319ab62d --- /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_unlock.c b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S index cda16f91ca..5e7b0fade9 100644 --- a/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c +++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S @@ -1,7 +1,5 @@ -/* pthread_spin_unlock -- unlock a spin lock. Generic version. - Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2012 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 @@ -17,13 +15,17 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pthreadP.h" -#include <atomic.h> +#include <sysdep.h> -int -pthread_spin_unlock (pthread_spinlock_t *lock) -{ - __asm __volatile ("membar #StoreStore | #LoadStore"); - *lock = 0; - return 0; -} + .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_trylock.c b/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.S index 7bbfef6ace..867b8b5024 100644 --- a/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c +++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.S @@ -1,6 +1,5 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2012 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 @@ -16,18 +15,13 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <errno.h> -#include "pthreadP.h" +#include <sysdep.h> +#include <pthread-errnos.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; -} + .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_lock.c b/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.S index e82053a534..e668c395c5 100644 --- a/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c +++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.S @@ -1,6 +1,5 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2012 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 @@ -16,23 +15,13 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pthreadP.h" +#include <sysdep.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; -} + .text +ENTRY(pthread_spin_unlock) + membar #StoreStore | #LoadStore + retl + stb %g0, [%o0] +END(pthread_spin_unlock) + +strong_alias (pthread_spin_unlock, pthread_spin_init) |