summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-08-15 03:06:11 +0000
committerMike Frysinger <vapier@gentoo.org>2005-08-15 03:06:11 +0000
commit2974b2a72237fa7abcb850b3f67b8375a65fbcb2 (patch)
treec808482b3f46c8c95d7d7d046c2551966d55d073 /libpthread/linuxthreads
parent17957c3015c7c189340c6a4be6d12053f3c7af12 (diff)
import thumb support from jbowler in Bug 385
Diffstat (limited to 'libpthread/linuxthreads')
-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;
}