summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/linuxthreads/sysdeps/arm/pt-machine.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libpthread/linuxthreads/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
index 71001ebc2..284567970 100644
--- a/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
+++ b/libpthread/linuxthreads/sysdeps/arm/pt-machine.h
@@ -39,9 +39,24 @@ testandset (int *spinlock)
{
register unsigned int ret;
+#if defined(__thumb__)
+ void *pc;
+ __asm__ __volatile__(
+ ".align 0\n"
+ "\tbx pc\n"
+ "\tnop\n"
+ "\t.arm\n"
+ "\tswp %0, %2, [%3]\n"
+ "\torr %1, pc, #1\n"
+ "\tbx %1\n"
+ "\t.force_thumb"
+ : "=r"(ret), "=r"(pc)
+ : "0"(1), "r"(spinlock));
+#else
__asm__ __volatile__("swp %0, %1, [%2]"
: "=r"(ret)
: "0"(1), "r"(spinlock));
+#endif
return ret;
}