Date: Sat, 5 Nov 2016 04:36:12 +0000 (UTC) From: Michal Meloun <mmel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308327 - stable/11/sys/arm/include Message-ID: <201611050436.uA54aCXE001844@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mmel Date: Sat Nov 5 04:36:12 2016 New Revision: 308327 URL: https://svnweb.freebsd.org/changeset/base/308327 Log: MFC r306667,r306668: r306667: ARM: Add atomic_swap_64(). It's need by linuxkpi and drm-next-4.7. r306668: ARM: Add mising early clobber modifier in atomic_swap_32(). Modified: stable/11/sys/arm/include/atomic-v6.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/atomic-v6.h ============================================================================== --- stable/11/sys/arm/include/atomic-v6.h Sat Nov 5 04:32:46 2016 (r308326) +++ stable/11/sys/arm/include/atomic-v6.h Sat Nov 5 04:36:12 2016 (r308327) @@ -652,7 +652,7 @@ atomic_swap_32(volatile uint32_t *p, uin " teq %[exf], #0 \n" " it ne \n" " bne 1b \n" - : [ret] "=r" (ret), + : [ret] "=&r" (ret), [exf] "=&r" (exflag) : [val] "r" (v), [ptr] "r" (p) @@ -660,6 +660,26 @@ atomic_swap_32(volatile uint32_t *p, uin return (ret); } +static __inline uint64_t +atomic_swap_64(volatile uint64_t *p, uint64_t v) +{ + uint64_t ret; + uint32_t exflag; + + __asm __volatile( + "1: ldrexd %Q[ret], %R[ret], [%[ptr]] \n" + " strexd %[exf], %Q[val], %R[val], [%[ptr]] \n" + " teq %[exf], #0 \n" + " it ne \n" + " bne 1b \n" + : [ret] "=&r" (ret), + [exf] "=&r" (exflag) + : [val] "r" (v), + [ptr] "r" (p) + : "cc", "memory"); + return (ret); +} + #undef ATOMIC_ACQ_REL #undef ATOMIC_ACQ_REL_LONG
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611050436.uA54aCXE001844>