mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-26 00:41:08 +00:00
21 lines
757 B
Diff
21 lines
757 B
Diff
|
diff --git a/src/sys/arch/arm/include/lock.h b/sys/arch/arm/include/lock.h
|
||
|
index c52a44f..3b4ba93 100644
|
||
|
--- a/src/sys/arch/arm/include/lock.h
|
||
|
+++ b/src/sys/arch/arm/include/lock.h
|
||
|
@@ -119,8 +119,13 @@ __swp(__cpu_simple_lock_t __val, volatile __cpu_simple_lock_t *__ptr)
|
||
|
return __rv;
|
||
|
#else
|
||
|
uint32_t __val32;
|
||
|
- __asm volatile("swpb %0, %1, [%2]"
|
||
|
- : "=&r" (__val32) : "r" (__val), "r" (__ptr) : "memory");
|
||
|
+ __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");
|
||
|
return __val32;
|
||
|
#endif
|
||
|
}
|