X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-x86_64%2Fsemaphore.h;h=1194888536b93736f3d2616c6cb4eddfd2803e56;hb=refs%2Fheads%2Fvserver;hp=a389aa6fe80f9207b49d4992ebf31f5303310e42;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h index a389aa6fe..119488853 100644 --- a/include/asm-x86_64/semaphore.h +++ b/include/asm-x86_64/semaphore.h @@ -106,13 +106,10 @@ static inline void down(struct semaphore * sem) __asm__ __volatile__( "# atomic down operation\n\t" - LOCK "decl %0\n\t" /* --sem->count */ - "js 2f\n" - "1:\n" - LOCK_SECTION_START("") - "2:\tcall __down_failed\n\t" - "jmp 1b\n" - LOCK_SECTION_END + LOCK_PREFIX "decl %0\n\t" /* --sem->count */ + "jns 1f\n\t" + "call __down_failed\n" + "1:" :"=m" (sem->count) :"D" (sem) :"memory"); @@ -130,15 +127,12 @@ static inline int down_interruptible(struct semaphore * sem) __asm__ __volatile__( "# atomic interruptible down operation\n\t" - LOCK "decl %1\n\t" /* --sem->count */ - "js 2f\n\t" - "xorl %0,%0\n" - "1:\n" - LOCK_SECTION_START("") - "2:\tcall __down_failed_interruptible\n\t" - "jmp 1b\n" - LOCK_SECTION_END - :"=a" (result), "=m" (sem->count) + "xorl %0,%0\n\t" + LOCK_PREFIX "decl %1\n\t" /* --sem->count */ + "jns 2f\n\t" + "call __down_failed_interruptible\n" + "2:\n" + :"=&a" (result), "=m" (sem->count) :"D" (sem) :"memory"); return result; @@ -154,15 +148,12 @@ static inline int down_trylock(struct semaphore * sem) __asm__ __volatile__( "# atomic interruptible down operation\n\t" - LOCK "decl %1\n\t" /* --sem->count */ - "js 2f\n\t" - "xorl %0,%0\n" - "1:\n" - LOCK_SECTION_START("") - "2:\tcall __down_failed_trylock\n\t" - "jmp 1b\n" - LOCK_SECTION_END - :"=a" (result), "=m" (sem->count) + "xorl %0,%0\n\t" + LOCK_PREFIX "decl %1\n\t" /* --sem->count */ + "jns 2f\n\t" + "call __down_failed_trylock\n\t" + "2:\n" + :"=&a" (result), "=m" (sem->count) :"D" (sem) :"memory","cc"); return result; @@ -178,13 +169,10 @@ static inline void up(struct semaphore * sem) { __asm__ __volatile__( "# atomic up operation\n\t" - LOCK "incl %0\n\t" /* ++sem->count */ - "jle 2f\n" - "1:\n" - LOCK_SECTION_START("") - "2:\tcall __up_wakeup\n\t" - "jmp 1b\n" - LOCK_SECTION_END + LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ + "jg 1f\n\t" + "call __up_wakeup\n" + "1:" :"=m" (sem->count) :"D" (sem) :"memory");