2014-08-14 15:16:06 +00:00
|
|
|
diff --git a/sys/arch/arm/include/lock.h b/sys/arch/arm/include/lock.h
|
|
|
|
index ba612d5..8e0e2f3 100644
|
2014-02-27 13:04:10 +00:00
|
|
|
--- a/src/sys/arch/arm/include/lock.h
|
|
|
|
+++ b/src/sys/arch/arm/include/lock.h
|
2014-08-14 15:16:06 +00:00
|
|
|
@@ -105,8 +105,18 @@ static __inline unsigned char
|
|
|
|
__swp(unsigned char __val, __cpu_simple_lock_t *__ptr)
|
|
|
|
{
|
2014-02-27 13:04:10 +00:00
|
|
|
uint32_t __val32;
|
2014-08-14 15:16:06 +00:00
|
|
|
+#ifdef _ARM_ARCH_6
|
|
|
|
__asm volatile("swpb %0, %1, [%2]"
|
|
|
|
: "=&r" (__val32) : "r" (__val), "r" (__ptr) : "memory");
|
|
|
|
+#else
|
2014-02-27 13:04:10 +00:00
|
|
|
+ __asm volatile(" 1: \n"
|
|
|
|
+ " ldrexb %0, [%2] \n"
|
|
|
|
+ " strexb r0, %1, [%2]\n"
|
|
|
|
+ " teqeq r0, #0 \n"
|
|
|
|
+ " bne 1b \n"
|
|
|
|
+ : "=&r" (__val32) : "r" (__val), "r" (__ptr)
|
|
|
|
+ : "memory", "r0");
|
2014-08-14 15:16:06 +00:00
|
|
|
+#endif
|
2014-02-27 13:04:10 +00:00
|
|
|
return __val32;
|
|
|
|
}
|
2014-08-14 15:16:06 +00:00
|
|
|
#else
|