diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2009-09-15 07:52:20 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2009-09-15 07:52:20 -0700 |
commit | 3e42572835a7d424545d63c04aff5b80ea18a045 (patch) | |
tree | 2747e0e2f443c292e434c58ae6980d10ac8941e0 /libcutils | |
parent | f647a3c8aa99073c1da882b22c08b7b2a17c318b (diff) | |
parent | 2f1013e6e41b3525119b846f395c0041427ad560 (diff) | |
download | system_core-3e42572835a7d424545d63c04aff5b80ea18a045.tar.gz system_core-3e42572835a7d424545d63c04aff5b80ea18a045.tar.bz2 system_core-3e42572835a7d424545d63c04aff5b80ea18a045.zip |
merge from open-source master
Diffstat (limited to 'libcutils')
-rw-r--r-- | libcutils/atomic-android-arm.S | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libcutils/atomic-android-arm.S b/libcutils/atomic-android-arm.S index f4299fded..4da619540 100644 --- a/libcutils/atomic-android-arm.S +++ b/libcutils/atomic-android-arm.S @@ -17,8 +17,7 @@ #include <machine/cpu-features.h> /* - * NOTE: these atomic operations are SMP safe on all architectures, - * except swap(), see below. + * NOTE: these atomic operations are SMP safe on all architectures. */ .text @@ -213,11 +212,18 @@ android_atomic_or: * output: r0 = old value */ -/* FIXME: this is not safe on SMP systems - * a general way to do it is to use kernel_cmpxchg */ - +/* replaced swp instruction with ldrex/strex for ARMv6 & ARMv7 */ android_atomic_swap: +#if defined (_ARM_HAVE_LDREX_STREX) +1: ldrex r2, [r1] + strex r3, r0, [r1] + teq r3, #0 + bne 1b + mov r0, r2 + mcr p15, 0, r0, c7, c10, 5 /* or, use dmb */ +#else swp r0, r0, [r1] +#endif bx lr /* |