From 4f2190efced688c2ba246a856b67db2dc68004c8 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Tue, 29 May 2018 13:43:16 +0000 Subject: [PATCH] Fix 32-bit buildworld for i386 after r334320. The 64-bit atomics defined for i386 are currently only available in the kernel space. Found by: cy@ MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c | 2 +- sys/cddl/compat/opensolaris/sys/atomic.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c b/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c index 087c560993ce..ee103557e686 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c @@ -53,7 +53,7 @@ atomic_init(void) #endif #if !defined(__LP64__) && !defined(__mips_n32) && \ - !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_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 2f242cc30e50..92b9e10978b6 100644 --- a/sys/cddl/compat/opensolaris/sys/atomic.h +++ b/sys/cddl/compat/opensolaris/sys/atomic.h @@ -36,8 +36,12 @@ atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c)) #define cas32 atomic_cmpset_32 +#if defined(__i386__) && (defined(_KERNEL) || defined(KLD_MODULE)) +#define I386_HAVE_ATOMIC64 +#endif + #if !defined(__LP64__) && !defined(__mips_n32) && \ - !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); #endif @@ -87,7 +91,7 @@ atomic_dec_32_nv(volatile uint32_t *target) } #if defined(__LP64__) || defined(__mips_n32) || \ - defined(ARM_HAVE_ATOMIC64) || defined(__i386__) + defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64) static __inline void atomic_dec_64(volatile uint64_t *target) {