mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 22:23:16 +00:00
f01472b308
Issue #1361
24 lines
784 B
Diff
24 lines
784 B
Diff
diff --git a/sys/arch/arm/include/lock.h b/sys/arch/arm/include/lock.h
|
|
index ba612d5..8e0e2f3 100644
|
|
--- a/src/sys/arch/arm/include/lock.h
|
|
+++ b/src/sys/arch/arm/include/lock.h
|
|
@@ -105,8 +105,18 @@ static __inline unsigned char
|
|
__swp(unsigned char __val, __cpu_simple_lock_t *__ptr)
|
|
{
|
|
uint32_t __val32;
|
|
+#ifdef _ARM_ARCH_6
|
|
__asm volatile("swpb %0, %1, [%2]"
|
|
: "=&r" (__val32) : "r" (__val), "r" (__ptr) : "memory");
|
|
+#else
|
|
+ __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");
|
|
+#endif
|
|
return __val32;
|
|
}
|
|
#else
|