Date: Thu, 13 Dec 2018 00:42:26 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342022 - head/sys/mips/include Message-ID: <201812130042.wBD0gQjq093051@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Thu Dec 13 00:42:26 2018 New Revision: 342022 URL: https://svnweb.freebsd.org/changeset/base/342022 Log: Correctly implemenet atomic_swap_long for mips64. MIPS64 has 64-bit longs, so use uint64_t for it, otherwise uint32_t. sizeof(long) == sizeof(ptr) for all platforms, so define atomic_swap_ptr in terms of atomic_swap_long. Submitted by: hps@ Modified: head/sys/mips/include/atomic.h Modified: head/sys/mips/include/atomic.h ============================================================================== --- head/sys/mips/include/atomic.h Wed Dec 12 22:39:17 2018 (r342021) +++ head/sys/mips/include/atomic.h Thu Dec 13 00:42:26 2018 (r342022) @@ -793,6 +793,7 @@ atomic_swap_64(volatile uint64_t *ptr, const uint64_t } #endif +#ifdef __mips_n64 static __inline unsigned long atomic_swap_long(volatile unsigned long *ptr, const unsigned long value) { @@ -800,16 +801,16 @@ atomic_swap_long(volatile unsigned long *ptr, const un retval = *ptr; - while (!atomic_fcmpset_32((volatile uint32_t *)ptr, - (uint32_t *)&retval, value)) + while (!atomic_fcmpset_64((volatile uint64_t *)ptr, + (uint64_t *)&retval, value)) ; return (retval); } - -static __inline uintptr_t -atomic_swap_ptr(volatile uintptr_t *ptr, const uintptr_t value) +#else +static __inline unsigned long +atomic_swap_long(volatile unsigned long *ptr, const unsigned long value) { - uintptr_t retval; + unsigned long retval; retval = *ptr; @@ -818,5 +819,7 @@ atomic_swap_ptr(volatile uintptr_t *ptr, const uintptr ; return (retval); } +#endif +#define atomic_swap_ptr(ptr, value) atomic_swap_long((unsigned long *)(ptr), value) #endif /* ! _MACHINE_ATOMIC_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812130042.wBD0gQjq093051>