summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorSukanya Rajkhowa <c_srajkh@quicinc.com>2009-11-19 20:02:46 -0800
committerSukanya Rajkhowa <c_srajkh@quicinc.com>2009-11-19 20:02:46 -0800
commit13494856a724106b356155f43959fde1bfc8dd1b (patch)
treea55e4d68867703c1fbf6af32360671fa61d077b7 /libc
parentf2c01a09f31a54e36754a1a3215ba434c41f6f40 (diff)
downloadbionic-13494856a724106b356155f43959fde1bfc8dd1b.zip
bionic-13494856a724106b356155f43959fde1bfc8dd1b.tar.gz
bionic-13494856a724106b356155f43959fde1bfc8dd1b.tar.bz2
bionic: Use ldrex/strex instead of swp instruction to be multicore safe
swp instruction is disabled by default on msm7630 target
Diffstat (limited to 'libc')
-rw-r--r--libc/arch-arm/bionic/atomics_arm.S7
1 files changed, 6 insertions, 1 deletions
diff --git a/libc/arch-arm/bionic/atomics_arm.S b/libc/arch-arm/bionic/atomics_arm.S
index f8b23e6..4890c76 100644
--- a/libc/arch-arm/bionic/atomics_arm.S
+++ b/libc/arch-arm/bionic/atomics_arm.S
@@ -139,7 +139,12 @@ __atomic_inc:
/* r0(new) r1(addr) -> r0(old) */
__atomic_swap:
- swp r0, r0, [r1]
+1:
+ .word 0xe1912f9f /* ldrex r2, [r1] */
+ .word 0xe1813f90 /* strex r3, r0, [r1] */
+ cmp r3, #0
+ bne 1b
+ mov r0, r2
bx lr
/* __futex_wait(*ftx, val, *timespec) */