From owner-svn-src-all@freebsd.org Thu Dec 13 00:42:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D058132BB8F; Thu, 13 Dec 2018 00:42:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0238C895B2; Thu, 13 Dec 2018 00:42:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC4431800D; Thu, 13 Dec 2018 00:42:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wBD0gQu1093052; Thu, 13 Dec 2018 00:42:26 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wBD0gQjq093051; Thu, 13 Dec 2018 00:42:26 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812130042.wBD0gQjq093051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 13 Dec 2018 00:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342022 - head/sys/mips/include X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/mips/include X-SVN-Commit-Revision: 342022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0238C895B2 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-1.33 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.83)[-0.828,0]; NEURAL_HAM_SHORT(-0.50)[-0.500,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2018 00:42:27 -0000 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_ */