summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/csky/pthread_spin_trylock.S
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/nptl/sysdeps/csky/pthread_spin_trylock.S')
-rw-r--r--libpthread/nptl/sysdeps/csky/pthread_spin_trylock.S16
1 files changed, 16 insertions, 0 deletions
diff --git a/libpthread/nptl/sysdeps/csky/pthread_spin_trylock.S b/libpthread/nptl/sysdeps/csky/pthread_spin_trylock.S
new file mode 100644
index 000000000..113e94d51
--- /dev/null
+++ b/libpthread/nptl/sysdeps/csky/pthread_spin_trylock.S
@@ -0,0 +1,16 @@
+#define _ERRNO_H 1
+#include <bits/errno.h>
+#include <sysdep.h>
+
+.text
+ENTRY (pthread_spin_trylock)
+ mov a2, a0
+ movi a0, 0
+ movi a1, 1
+ trap 2 // trap 2 use to cmpxchg
+ cmpnei a0, 0
+ bf 1f
+ movi a0, EBUSY
+1:
+ jmp r15
+END (pthread_spin_trylock)