summaryrefslogtreecommitdiffstats
path: root/sys/arm/include/atomic.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-07-27 20:01:45 +0000
committerjhb <jhb@FreeBSD.org>2005-07-27 20:01:45 +0000
commitb8779c810b9f3babd08da008e9fc252ab822d00c (patch)
treefbbb32e1905bc618ae6151786ba54f1b132df556 /sys/arm/include/atomic.h
parent75a402d1cc655b66a1c7919d67bab6e0f584ea0f (diff)
downloadFreeBSD-src-b8779c810b9f3babd08da008e9fc252ab822d00c.zip
FreeBSD-src-b8779c810b9f3babd08da008e9fc252ab822d00c.tar.gz
Add extra constraints to tell the compiler that the memory be modified
in the arm __swp() and sparc64 casa() and casax() functions is actually being used as an input and output and not just the value of the register that points to the memory location. This was the underlying source of the mbuf refcount problems on sparc64 a while back. For arm this should be a nop because __swp() has a constraint to clobber all memory which can probably be removed now. Reviewed by: alc, cognet MFC after: 1 week
Diffstat (limited to 'sys/arm/include/atomic.h')
-rw-r--r--sys/arm/include/atomic.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h
index 4275010..1170847 100644
--- a/sys/arm/include/atomic.h
+++ b/sys/arm/include/atomic.h
@@ -77,8 +77,10 @@
static __inline uint32_t
__swp(uint32_t val, volatile uint32_t *ptr)
{
- __asm __volatile("swp %0, %1, [%2]"
- : "=&r" (val) : "r" (val) , "r" (ptr) : "memory");
+ __asm __volatile("swp %0, %2, [%3]"
+ : "=&r" (val), "=m" (*ptr)
+ : "r" (val) , "r" (ptr), "m" (*ptr)
+ : "memory");
return (val);
}
OpenPOWER on IntegriCloud