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
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to