atomic - fix inline assembly
authorAlex Hornung <ahornung@gmail.com>
Wed, 18 Nov 2009 19:54:13 +0000 (19:54 +0000)
committerAlex Hornung <ahornung@gmail.com>
Wed, 18 Nov 2009 20:26:35 +0000 (20:26 +0000)
* Mark eax as early clobber in atomic_intr_cond_try. This solves a
  longstanding and previously conditionalized issue with clang.
  Marking it as early clobber avoids it being used as a register
  elsewhere, apart from explicit uses.
  GCC behaviour is not affected.

Suggested-by: Dale Johannesen <dalej@apple.com>
sys/cpu/i386/include/atomic.h
sys/cpu/x86_64/include/atomic.h

index 34fd431..0960c75 100644 (file)
@@ -309,12 +309,8 @@ atomic_intr_cond_try(__atomic_intr_t *p)
                         MPLOCKED "decl %0; "                   \
                         "movl $1,%%eax;"                       \
                         "2: ;"
-                        : "+m" (*p), "=a"(ret)
-#ifdef __clang__
-                         : : "ax", "cx", "dx");
-#else
+                        : "+m" (*p), "=&a"(ret)
                          : : "cx", "dx");
-#endif
        return (ret);
 }
 
index cc543d3..b6d0b66 100644 (file)
@@ -331,12 +331,8 @@ atomic_intr_cond_try(__atomic_intr_t *p)
                         MPLOCKED "decl %0; "                   \
                         "movl $1,%%eax;"                       \
                         "2: ;"
-                        : "+m" (*p), "=a"(ret)
-#ifdef __clang__
-                         : : "ax", "cx", "dx");
-#else
+                        : "+m" (*p), "=&a"(ret)
                          : : "cx", "dx");
-#endif
        return (ret);
 }