diff options
author | Ng, David <dng@quicinc.com> | 2009-08-18 16:08:59 -0700 |
---|---|---|
committer | Ng, David <dng@quicinc.com> | 2009-08-18 16:08:59 -0700 |
commit | 6358065d732cf4c5eb49e52487f87b56ac607168 (patch) | |
tree | 3cf5f03e07fe246a077a04947b241e00e009209a | |
parent | 8e88603bdcf893086ec5e6b470d063a6be0fa0c5 (diff) | |
download | bionic-6358065d732cf4c5eb49e52487f87b56ac607168.zip bionic-6358065d732cf4c5eb49e52487f87b56ac607168.tar.gz bionic-6358065d732cf4c5eb49e52487f87b56ac607168.tar.bz2 |
bionic: Replace ARM SWP instruction with LDREX/STREX
Replace SWP instruction with ARMv6+ LDREX/STREX. Using
hardcoded binary instructions as the current default
Android compiler flag is set to compile for ARMv5 only.
-rw-r--r-- | libc/arch-arm/bionic/atomics_arm.S | 7 |
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 b2da09f..0fba152 100644 --- a/libc/arch-arm/bionic/atomics_arm.S +++ b/libc/arch-arm/bionic/atomics_arm.S @@ -130,7 +130,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) */ |