Date: Tue, 10 Jan 2017 21:10:20 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311898 - head/sys/sparc64/include Message-ID: <201701102110.v0ALAKQw082227@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Tue Jan 10 21:10:20 2017 New Revision: 311898 URL: https://svnweb.freebsd.org/changeset/base/311898 Log: sparc64: add atomic_fcmpset Tested on hardware provided by feld. Reviewed by: marius Modified: head/sys/sparc64/include/atomic.h Modified: head/sys/sparc64/include/atomic.h ============================================================================== --- head/sys/sparc64/include/atomic.h Tue Jan 10 20:52:44 2017 (r311897) +++ head/sys/sparc64/include/atomic.h Tue Jan 10 21:10:20 2017 (r311898) @@ -219,6 +219,40 @@ atomic_cmpset_rel_ ## name(volatile ptyp return (((vtype)atomic_cas_rel((p), (e), (s), sz)) == (e)); \ } \ \ +static __inline int \ +atomic_fcmpset_ ## name(volatile ptype p, vtype *ep, vtype s) \ +{ \ + vtype t; \ + \ + t = (vtype)atomic_cas((p), (*ep), (s), sz); \ + if (t == (*ep)) \ + return (1); \ + *ep = t; \ + return (0); \ +} \ +static __inline int \ +atomic_fcmpset_acq_ ## name(volatile ptype p, vtype *ep, vtype s) \ +{ \ + vtype t; \ + \ + t = (vtype)atomic_cas_acq((p), (*ep), (s), sz); \ + if (t == (*ep)) \ + return (1); \ + *ep = t; \ + return (0); \ +} \ +static __inline int \ +atomic_fcmpset_rel_ ## name(volatile ptype p, vtype *ep, vtype s) \ +{ \ + vtype t; \ + \ + t = (vtype)atomic_cas_rel((p), (*ep), (s), sz); \ + if (t == (*ep)) \ + return (1); \ + *ep = t; \ + return (0); \ +} \ + \ static __inline vtype \ atomic_load_ ## name(volatile ptype p) \ { \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701102110.v0ALAKQw082227>