Date: Mon, 1 Oct 2012 05:12:18 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241080 - head/sys/arm/include Message-ID: <201210010512.q915CIJM085583@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Mon Oct 1 05:12:17 2012 New Revision: 241080 URL: http://svn.freebsd.org/changeset/base/241080 Log: Fix the clobber list on the atomic operators that do comparisons. Without this some compilers will place a cmp instruction before the atomic operation and expect to be able to use the result afterwards. By adding "cc" to the list of used registers we tell the compiler to not do this. Modified: head/sys/arm/include/atomic.h Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Mon Oct 1 03:17:23 2012 (r241079) +++ head/sys/arm/include/atomic.h Mon Oct 1 05:12:17 2012 (r241080) @@ -123,7 +123,7 @@ atomic_set_32(volatile uint32_t *address "cmp %1, #0\n" "bne 1b\n" : "=&r" (tmp), "+r" (tmp2) - , "+r" (address), "+r" (setmask) : : "memory"); + , "+r" (address), "+r" (setmask) : : "cc", "memory"); } @@ -138,7 +138,7 @@ atomic_set_long(volatile u_long *address "cmp %1, #0\n" "bne 1b\n" : "=&r" (tmp), "+r" (tmp2) - , "+r" (address), "+r" (setmask) : : "memory"); + , "+r" (address), "+r" (setmask) : : "cc", "memory"); } @@ -153,7 +153,7 @@ atomic_clear_32(volatile uint32_t *addre "cmp %1, #0\n" "bne 1b\n" : "=&r" (tmp), "+r" (tmp2) - ,"+r" (address), "+r" (setmask) : : "memory"); + ,"+r" (address), "+r" (setmask) : : "cc", "memory"); } static __inline void @@ -167,7 +167,7 @@ atomic_clear_long(volatile u_long *addre "cmp %1, #0\n" "bne 1b\n" : "=&r" (tmp), "+r" (tmp2) - ,"+r" (address), "+r" (setmask) : : "memory"); + ,"+r" (address), "+r" (setmask) : : "cc", "memory"); } static __inline u_int32_t @@ -185,7 +185,8 @@ atomic_cmpset_32(volatile u_int32_t *p, "moveq %0, #1\n" "2:" : "=&r" (ret) - ,"+r" (p), "+r" (cmpval), "+r" (newval) : : "memory"); + ,"+r" (p), "+r" (cmpval), "+r" (newval) : : "cc", + "memory"); return (ret); } @@ -204,7 +205,8 @@ atomic_cmpset_long(volatile u_long *p, v "moveq %0, #1\n" "2:" : "=&r" (ret) - ,"+r" (p), "+r" (cmpval), "+r" (newval) : : "memory"); + ,"+r" (p), "+r" (cmpval), "+r" (newval) : : "cc", + "memory"); return (ret); } @@ -254,7 +256,7 @@ atomic_add_32(volatile u_int32_t *p, u_i "cmp %1, #0\n" "bne 1b\n" : "=&r" (tmp), "+r" (tmp2) - ,"+r" (p), "+r" (val) : : "memory"); + ,"+r" (p), "+r" (val) : : "cc", "memory"); } static __inline void @@ -268,7 +270,7 @@ atomic_add_long(volatile u_long *p, u_lo "cmp %1, #0\n" "bne 1b\n" : "=&r" (tmp), "+r" (tmp2) - ,"+r" (p), "+r" (val) : : "memory"); + ,"+r" (p), "+r" (val) : : "cc", "memory"); } static __inline void @@ -282,7 +284,7 @@ atomic_subtract_32(volatile u_int32_t *p "cmp %1, #0\n" "bne 1b\n" : "=&r" (tmp), "+r" (tmp2) - ,"+r" (p), "+r" (val) : : "memory"); + ,"+r" (p), "+r" (val) : : "cc", "memory"); } static __inline void @@ -296,7 +298,7 @@ atomic_subtract_long(volatile u_long *p, "cmp %1, #0\n" "bne 1b\n" : "=&r" (tmp), "+r" (tmp2) - ,"+r" (p), "+r" (val) : : "memory"); + ,"+r" (p), "+r" (val) : : "cc", "memory"); } ATOMIC_ACQ_REL(clear, 32) @@ -322,7 +324,7 @@ atomic_fetchadd_32(volatile uint32_t *p, "cmp %2, #0\n" "bne 1b\n" : "+r" (ret), "=&r" (tmp), "+r" (tmp2) - ,"+r" (p), "+r" (val) : : "memory"); + ,"+r" (p), "+r" (val) : : "cc", "memory"); return (ret); } @@ -337,7 +339,7 @@ atomic_readandclear_32(volatile u_int32_ "cmp %2, #0\n" "bne 1b\n" : "=r" (ret), "=&r" (tmp), "+r" (tmp2) - ,"+r" (p) : : "memory"); + ,"+r" (p) : : "cc", "memory"); return (ret); } @@ -370,7 +372,7 @@ atomic_fetchadd_long(volatile u_long *p, "cmp %2, #0\n" "bne 1b\n" : "+r" (ret), "=&r" (tmp), "+r" (tmp2) - ,"+r" (p), "+r" (val) : : "memory"); + ,"+r" (p), "+r" (val) : : "cc", "memory"); return (ret); } @@ -385,7 +387,7 @@ atomic_readandclear_long(volatile u_long "cmp %2, #0\n" "bne 1b\n" : "=r" (ret), "=&r" (tmp), "+r" (tmp2) - ,"+r" (p) : : "memory"); + ,"+r" (p) : : "cc", "memory"); return (ret); } @@ -516,7 +518,7 @@ atomic_cmpset_32(volatile u_int32_t *p, "moveq %1, #1\n" "movne %1, #0\n" : "+r" (ras_start), "=r" (done) - ,"+r" (p), "+r" (cmpval), "+r" (newval) : : "memory"); + ,"+r" (p), "+r" (cmpval), "+r" (newval) : : "cc", "memory"); return (done); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210010512.q915CIJM085583>