Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Mar 2017 22:22:25 +0000 (UTC)
From:      Mateusz Guzik <mjg@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: r315874 - stable/11/sys/arm/include
Message-ID:  <201703232222.v2NMMPjA043313@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Thu Mar 23 22:22:24 2017
New Revision: 315874
URL: https://svnweb.freebsd.org/changeset/base/315874

Log:
  MFC r312932,r312933,r312949,r313141
  
  (by cognet)
  
  Use strexeq instead of needlessly branch.
  
  ==
  
  (by cognet)
  
  Remove useless labels.
  
  ==
  
  (by cognet)
  
  Correct the IT instruction in atomic_fcmpset_64().
  
  ==
  
  (by andrew)
  
  Only define atomic_fcmpset_long in the kernel. We may include
  machine/atomic.h in userspace, however atomic_fcmpset_32 is unimplemented
  there.

Modified:
  stable/11/sys/arm/include/atomic-v4.h
  stable/11/sys/arm/include/atomic-v6.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/include/atomic-v4.h
==============================================================================
--- stable/11/sys/arm/include/atomic-v4.h	Thu Mar 23 22:14:08 2017	(r315873)
+++ stable/11/sys/arm/include/atomic-v4.h	Thu Mar 23 22:22:24 2017	(r315874)
@@ -463,6 +463,8 @@ atomic_cmpset_long(volatile u_long *dst,
 	return (atomic_cmpset_32((volatile uint32_t *)dst, old, newe));
 }
 
+#ifdef _KERNEL
+/* atomic_fcmpset_32 is only defined for the kernel */
 static __inline u_long
 atomic_fcmpset_long(volatile u_long *dst, u_long *old, u_long newe)
 {
@@ -470,6 +472,7 @@ atomic_fcmpset_long(volatile u_long *dst
 	return (atomic_fcmpset_32((volatile uint32_t *)dst,
 	    (uint32_t *)old, newe));
 }
+#endif
 
 static __inline u_long
 atomic_fetchadd_long(volatile u_long *p, u_long v)

Modified: stable/11/sys/arm/include/atomic-v6.h
==============================================================================
--- stable/11/sys/arm/include/atomic-v6.h	Thu Mar 23 22:14:08 2017	(r315873)
+++ stable/11/sys/arm/include/atomic-v6.h	Thu Mar 23 22:22:24 2017	(r315874)
@@ -198,13 +198,11 @@ atomic_fcmpset_32(volatile uint32_t *p, 
 	int ret;
 
 	__asm __volatile(
-	    "1: mov 	%0, #1		\n"
+	    "   mov 	%0, #1		\n"
 	    "   ldrex	%1, [%2]	\n"
 	    "   cmp	%1, %3		\n"
-	    "   it	ne		\n"
-	    "   bne	2f		\n"
-	    "   strex	%0, %4, [%2]	\n"
-	    "2:"
+	    "   it	eq		\n"
+	    "   strexeq	%0, %4, [%2]	\n"
 	    : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval)
 	    : : "cc", "memory");
 	*cmpval = tmp;
@@ -222,7 +220,7 @@ atomic_fcmpset_64(volatile uint64_t *p, 
 	    "1:	mov	%[ret], #1				\n"
 	    "   ldrexd	%Q[tmp], %R[tmp], [%[ptr]]		\n"
 	    "   teq	%Q[tmp], %Q[_cmpval]			\n"
-	    "   itee	eq					\n"
+	    "   ite	eq					\n"
 	    "   teqeq	%R[tmp], %R[_cmpval]			\n"
 	    "   bne	2f					\n"
 	    "   strexd	%[ret], %Q[newval], %R[newval], [%[ptr]]\n"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703232222.v2NMMPjA043313>