From c311f7078c8493a07a9fcaf3916493065eb64e9a Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sat, 2 Aug 2014 03:44:27 +0000 Subject: [PATCH] When arm 64-bit atomic ops are available, define ARM_HAVE_ATOMIC64. Use that symbol (which will be correct in both kernel and userland contexts) rather than just __arm__ to decide whether to use a local implementation. --- sys/arm/include/atomic.h | 4 ++++ sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c | 2 +- sys/cddl/compat/opensolaris/sys/atomic.h | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h index c6b00089a5b4..a62ca0037446 100644 --- a/sys/arm/include/atomic.h +++ b/sys/arm/include/atomic.h @@ -88,6 +88,8 @@ defined (__ARM_ARCH_6T2__) || \ defined (__ARM_ARCH_6Z__) || \ defined (__ARM_ARCH_6ZK__) +#define ARM_HAVE_ATOMIC64 + static __inline void __do_dmb(void) { @@ -722,6 +724,8 @@ __swp(uint32_t val, volatile uint32_t *ptr) #ifdef _KERNEL +#define ARM_HAVE_ATOMIC64 + static __inline void atomic_set_32(volatile uint32_t *address, uint32_t setmask) { diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c b/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c index 4aba9ea6cfe5..8a0fdf387fac 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c @@ -52,7 +52,7 @@ atomic_init(void) } #endif -#if !defined(__LP64__) && !defined(__mips_n32) +#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64) void atomic_add_64(volatile uint64_t *target, int64_t delta) { diff --git a/sys/cddl/compat/opensolaris/sys/atomic.h b/sys/cddl/compat/opensolaris/sys/atomic.h index 813cda0d3802..65c9e7124593 100644 --- a/sys/cddl/compat/opensolaris/sys/atomic.h +++ b/sys/cddl/compat/opensolaris/sys/atomic.h @@ -36,7 +36,7 @@ atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c)) #define cas32 atomic_cmpset_32 -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(__arm__) +#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); #endif @@ -85,7 +85,7 @@ atomic_dec_32_nv(volatile uint32_t *target) return (atomic_fetchadd_32(target, -1) - 1); } -#if defined(__LP64__) || defined(__mips_n32) || defined(__arm__) +#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64) static __inline void atomic_dec_64(volatile uint64_t *target) {