summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2009-09-15 07:51:39 -0700
committerJean-Baptiste Queru <jbq@google.com>2009-09-15 07:51:39 -0700
commitcdeb4c8afa2fb7b92cce3b32a9d2f3c05ad759ba (patch)
treec92b4205ab7379cf157a88b8e9709794e70119fd
parent664dac1e959dda5f017571d52ab4a34891800927 (diff)
parent76ec6891e2bc18c9e12cd2f567358bb817b24cff (diff)
downloadbionic-cdeb4c8afa2fb7b92cce3b32a9d2f3c05ad759ba.zip
bionic-cdeb4c8afa2fb7b92cce3b32a9d2f3c05ad759ba.tar.gz
bionic-cdeb4c8afa2fb7b92cce3b32a9d2f3c05ad759ba.tar.bz2
merge from open-source master
-rw-r--r--libc/arch-arm/bionic/atomics_arm.S10
-rw-r--r--libc/arch-arm/include/machine/cpu-features.h7
-rw-r--r--libc/netbsd/net/getservent.c2
3 files changed, 18 insertions, 1 deletions
diff --git a/libc/arch-arm/bionic/atomics_arm.S b/libc/arch-arm/bionic/atomics_arm.S
index b2da09f..57c4239 100644
--- a/libc/arch-arm/bionic/atomics_arm.S
+++ b/libc/arch-arm/bionic/atomics_arm.S
@@ -129,8 +129,18 @@ __atomic_inc:
#endif
/* r0(new) r1(addr) -> r0(old) */
+/* replaced swp instruction with ldrex/strex for ARMv6 & ARMv7 */
__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
/* __futex_wait(*ftx, val, *timespec) */
diff --git a/libc/arch-arm/include/machine/cpu-features.h b/libc/arch-arm/include/machine/cpu-features.h
index f836006..ecf6ff6 100644
--- a/libc/arch-arm/include/machine/cpu-features.h
+++ b/libc/arch-arm/include/machine/cpu-features.h
@@ -149,6 +149,13 @@
# define __ARM_HAVE_PC_INTERWORK
#endif
+/* define _ARM_HAVE_LDREX_STREX for ARMv6 and ARMv7 architecure to be
+ * used in replacement of depricated swp instruction
+ */
+#if __ARM_ARCH__ >= 6
+# define _ARM_HAVE_LDREX_STREX
+#endif
+
/* Assembly-only macros */
diff --git a/libc/netbsd/net/getservent.c b/libc/netbsd/net/getservent.c
index 65fbd7e..9f6ec32 100644
--- a/libc/netbsd/net/getservent.c
+++ b/libc/netbsd/net/getservent.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
#include <sys/types.h>
-#include <sys/endian.h>
+#include <endian.h>
#include <netdb.h>
#include "servent.h"
#include "services.h"