summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/metag/pthread_spin_lock.S
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/nptl/sysdeps/metag/pthread_spin_lock.S')
-rw-r--r--libpthread/nptl/sysdeps/metag/pthread_spin_lock.S20
1 files changed, 20 insertions, 0 deletions
diff --git a/libpthread/nptl/sysdeps/metag/pthread_spin_lock.S b/libpthread/nptl/sysdeps/metag/pthread_spin_lock.S
new file mode 100644
index 000000000..66e94c7a9
--- /dev/null
+++ b/libpthread/nptl/sysdeps/metag/pthread_spin_lock.S
@@ -0,0 +1,20 @@
+! Copyright (C) 2013 Imagination Technologies Ltd.
+
+! Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+
+ .text
+ .global _pthread_spin_lock
+ .type _pthread_spin_lock,function
+_pthread_spin_lock:
+1: LNKGETD D0Ar2, [D1Ar1]
+ CMP D0Ar2, #0
+ ADD D0Ar2, D0Ar2, #1
+ LNKSETDEQ [D1Ar1], D0Ar2
+ BNE 1b
+ DEFR D0Ar2, TXSTAT
+ ANDT D0Ar2, D0Ar2, #HI(0x3f000000)
+ CMPT D0Ar2, #HI(0x02000000)
+ BNZ 1b
+ MOV D0Re0, #0
+ MOV PC, D1RtP
+ .size _pthread_spin_lock,.-_pthread_spin_lock