fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / asm-i386 / mutex.h
index 9b2199e..7a17d9e 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef _ASM_MUTEX_H
 #define _ASM_MUTEX_H
 
+#include "asm/alternative.h"
+
 /**
  *  __mutex_fastpath_lock - try to take the lock by moving the count
  *                          from 1 to a 0 value
@@ -27,15 +29,11 @@ do {                                                                        \
        typecheck_fn(fastcall void (*)(atomic_t *), fail_fn);           \
                                                                        \
        __asm__ __volatile__(                                           \
-               LOCK    "   decl (%%eax)        \n"                     \
-                       "   js 2f               \n"                     \
+               LOCK_PREFIX "   decl (%%eax)    \n"                     \
+                       "   jns 1f              \n"                     \
+                       "   call "#fail_fn"     \n"                     \
                        "1:                     \n"                     \
                                                                        \
-               LOCK_SECTION_START("")                                  \
-                       "2: call "#fail_fn"     \n"                     \
-                       "   jmp 1b              \n"                     \
-               LOCK_SECTION_END                                        \
-                                                                       \
                :"=a" (dummy)                                           \
                : "a" (count)                                           \
                : "memory", "ecx", "edx");                              \
@@ -83,15 +81,11 @@ do {                                                                        \
        typecheck_fn(fastcall void (*)(atomic_t *), fail_fn);           \
                                                                        \
        __asm__ __volatile__(                                           \
-               LOCK    "   incl (%%eax)        \n"                     \
-                       "   jle 2f              \n"                     \
+               LOCK_PREFIX "   incl (%%eax)    \n"                     \
+                       "   jg  1f              \n"                     \
+                       "   call "#fail_fn"     \n"                     \
                        "1:                     \n"                     \
                                                                        \
-               LOCK_SECTION_START("")                                  \
-                       "2: call "#fail_fn"     \n"                     \
-                       "   jmp 1b              \n"                     \
-               LOCK_SECTION_END                                        \
-                                                                       \
                :"=a" (dummy)                                           \
                : "a" (count)                                           \
                : "memory", "ecx", "edx");                              \