svn commit: r306667 - head/sys/arm/include
Michal Meloun
mmel at FreeBSD.org
Tue Oct 4 09:51:55 UTC 2016
Author: mmel
Date: Tue Oct 4 09:51:54 2016
New Revision: 306667
URL: https://svnweb.freebsd.org/changeset/base/306667
Log:
ARM: Add atomic_swap_64(). It's need by linuxkpi and drm-next-4.7.
MFC after: 2 weeks
Modified:
head/sys/arm/include/atomic-v6.h
Modified: head/sys/arm/include/atomic-v6.h
==============================================================================
--- head/sys/arm/include/atomic-v6.h Tue Oct 4 09:14:48 2016 (r306666)
+++ head/sys/arm/include/atomic-v6.h Tue Oct 4 09:51:54 2016 (r306667)
@@ -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
More information about the svn-src-all
mailing list