Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Oct 2005 17:26:12 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 85221 for review
Message-ID:  <200510131726.j9DHQCk0067363@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=85221

Change 85221 by jhb@jhb_slimer on 2005/10/13 17:26:01

	Try to use memory operands in atomic operations and add missing
	constraints to let the compiler know that the memory is modified
	for the userland atomic operations.

Affected files ...

.. //depot/projects/smpng/sys/arm/include/atomic.h#19 edit

Differences ...

==== //depot/projects/smpng/sys/arm/include/atomic.h#19 (text+ko) ====

@@ -77,9 +77,9 @@
 static __inline uint32_t
 __swp(uint32_t val, volatile uint32_t *ptr)
 {
-	__asm __volatile("swp	%0, %2, [%3]"
+	__asm __volatile("swp	%0, %2, %1"
 	    : "=&r" (val), "=m" (*ptr)
-	    : "r" (val) , "r" (ptr), "m" (*ptr)
+	    : "r" (val) , "m" (*ptr)
 	    : "memory");
 	return (val);
 }
@@ -154,16 +154,17 @@
 	    "adr	%1, 1b\n"
 	    "mov	%0, #0xe0000004\n"
 	    "str	%1, [%0]\n"
-	    "ldr	%1, [%2]\n"
+	    "ldr	%1, %2\n"
 	    "cmp	%1, %3\n"
-	    "streq	%4, [%2]\n"
+	    "streq	%4, %2\n"
 	    "2:\n"
 	    "mov	%1, #0\n"
 	    "str	%1, [%0]\n"
 	    "moveq	%1, #1\n"
 	    "movne	%1, #0\n"
 	    : "=r" (ras_start), "=r" (done)
-	    ,"+r" (p), "+r" (cmpval), "+r" (newval));
+	    ,"=m" (*p), "+r" (cmpval), "+r" (newval)
+	    : "m" (*p));
 	return (done);
 }
 
@@ -179,13 +180,14 @@
 	    "adr	%1, 1b\n"
 	    "mov	%0, #0xe0000004\n"
 	    "str	%1, [%0]\n"
-	    "ldr	%1, [%2]\n"
+	    "ldr	%1, %2\n"
 	    "add	%1, %1, %3\n"
-	    "str	%1, [%2]\n"
+	    "str	%1, %2\n"
 	    "2:\n"
 	    "mov	%1, #0\n"
 	    "str	%1, [%0]\n"
-	    : "=r" (ras_start), "=r" (start), "+r" (p), "+r" (val));
+	    : "=r" (ras_start), "=r" (start), "=m" (*p), "+r" (val)
+	    : "m" (*p));
 }
 
 static __inline void
@@ -200,14 +202,15 @@
 	    "adr	%1, 1b\n"
 	    "mov	%0, #0xe0000004\n"
 	    "str	%1, [%0]\n"
-	    "ldr	%1, [%2]\n"
+	    "ldr	%1, %2\n"
 	    "sub	%1, %1, %3\n"
-	    "str	%1, [%2]\n"
+	    "str	%1, %2\n"
 	    "2:\n"
 	    "mov	%1, #0\n"
 	    "str	%1, [%0]\n"
 
-	    : "=r" (ras_start), "=r" (start), "+r" (p), "+r" (val));
+	    : "=r" (ras_start), "=r" (start), "=m" (*p), "+r" (val)
+	    : "m" (*p));
 }
 
 static __inline void
@@ -222,14 +225,15 @@
 	    "adr	%1, 1b\n"
 	    "mov	%0, #0xe0000004\n"
 	    "str	%1, [%0]\n"
-	    "ldr	%1, [%2]\n"
+	    "ldr	%1, %2\n"
 	    "orr	%1, %1, %3\n"
-	    "str	%1, [%2]\n"
+	    "str	%1, %2\n"
 	    "2:\n"
 	    "mov	%1, #0\n"
 	    "str	%1, [%0]\n"
 
-	    : "=r" (ras_start), "=r" (start), "+r" (address), "+r" (setmask));
+	    : "=r" (ras_start), "=r" (start), "=m" (*address), "+r" (setmask)
+	    : "m" (*address));
 }
 
 static __inline void
@@ -244,13 +248,14 @@
 	    "adr	%1, 1b\n"
 	    "mov	%0, #0xe0000004\n"
 	    "str	%1, [%0]\n"
-	    "ldr	%1, [%2]\n"
+	    "ldr	%1, %2\n"
 	    "bic	%1, %1, %3\n"
-	    "str	%1, [%2]\n"
+	    "str	%1, %2\n"
 	    "2:\n"
 	    "mov	%1, #0\n"
 	    "str	%1, [%0]\n"
-	    : "=r" (ras_start), "=r" (start), "+r" (address), "+r" (clearmask));
+	    : "=r" (ras_start), "=r" (start), "=m" (*address), "+r" (clearmask)
+	    : "m" (*address));
 
 }
 
@@ -272,7 +277,8 @@
 	    "2:\n"
 	    "mov	%3, #0\n"
 	    "str	%3, [%0]\n"
-	    : "=r" (ras_start), "=r" (start), "=m" (*p), "+r" (v));
+	    : "=r" (ras_start), "=r" (start), "=m" (*p), "+r" (v)
+	    : "m" (*p));
 	return (start);
 }
 



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