[PATCH] - small cleanups to asm constraints
John Baldwin
jhb at FreeBSD.org
Wed Jul 20 14:59:26 GMT 2005
Can you please test the patch below. It makes use of the + modifier for a
register variable in one place and fixes the asm constraints for _swp() to
specify that _swp() modifies the memory being modified, not just the address
of the memory (which isn't actually modified at that). Note that this means
that the generic "memory" clobber can probably be removed, but I haven't done
that yet:
--- //depot/vendor/freebsd/src/sys/arm/include/atomic.h 2005/07/15 18:20:34
+++ //depot/projects/smpng/sys/arm/include/atomic.h 2005/07/18 17:20:49
@@ -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);
}
--- //depot/vendor/freebsd/src/sys/arm/include/endian.h 2005/05/24 21:45:17
+++ //depot/projects/smpng/sys/arm/include/endian.h 2005/07/18 17:20:49
@@ -100,11 +100,10 @@
__bswap16_var(__uint16_t v)
{
__asm __volatile(
- "mov %0, %1, ror #8\n"
+ "mov %0, %0, ror #8\n"
"orr %0, %0, %0, lsr #16\n"
"bic %0, %0, %0, lsl #16"
- : "=r" (v)
- : "0" (v));
+ : "+r" (v));
return (v);
}
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-arm
mailing list