X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-i386%2Fsemaphore.h;h=f7a0f310c5243e10b668442d5ab70b9258614b5c;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=1db03a68622dc33954ba217e1944ac23a458c09c;hpb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;p=linux-2.6.git diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h index 1db03a686..f7a0f310c 100644 --- a/include/asm-i386/semaphore.h +++ b/include/asm-i386/semaphore.h @@ -55,9 +55,6 @@ struct semaphore { .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ } -#define __MUTEX_INITIALIZER(name) \ - __SEMAPHORE_INITIALIZER(name,1) - #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) @@ -87,15 +84,10 @@ static inline void init_MUTEX_LOCKED (struct semaphore *sem) sema_init(sem, 0); } -asmlinkage void __down_failed(void /* special register calling convention */); -asmlinkage int __down_failed_interruptible(void /* params in registers */); -asmlinkage int __down_failed_trylock(void /* params in registers */); -asmlinkage void __up_wakeup(void /* special register calling convention */); - -asmlinkage void __down(struct semaphore * sem); -asmlinkage int __down_interruptible(struct semaphore * sem); -asmlinkage int __down_trylock(struct semaphore * sem); -asmlinkage void __up(struct semaphore * sem); +fastcall void __down_failed(void /* special register calling convention */); +fastcall int __down_failed_interruptible(void /* params in registers */); +fastcall int __down_failed_trylock(void /* params in registers */); +fastcall void __up_wakeup(void /* special register calling convention */); /* * This is ugly, but we want the default case to fall through. @@ -107,16 +99,17 @@ static inline void down(struct semaphore * sem) might_sleep(); __asm__ __volatile__( "# atomic down operation\n\t" - LOCK "decl %0\n\t" /* --sem->count */ + LOCK_PREFIX "decl %0\n\t" /* --sem->count */ "js 2f\n" "1:\n" LOCK_SECTION_START("") - "2:\tcall __down_failed\n\t" + "2:\tlea %0,%%eax\n\t" + "call __down_failed\n\t" "jmp 1b\n" LOCK_SECTION_END :"=m" (sem->count) - :"c" (sem) - :"memory"); + : + :"memory","ax"); } /* @@ -130,16 +123,17 @@ static inline int down_interruptible(struct semaphore * sem) might_sleep(); __asm__ __volatile__( "# atomic interruptible down operation\n\t" - LOCK "decl %1\n\t" /* --sem->count */ + LOCK_PREFIX "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" + "2:\tlea %1,%%eax\n\t" + "call __down_failed_interruptible\n\t" "jmp 1b\n" LOCK_SECTION_END :"=a" (result), "=m" (sem->count) - :"c" (sem) + : :"memory"); return result; } @@ -154,16 +148,17 @@ static inline int down_trylock(struct semaphore * sem) __asm__ __volatile__( "# atomic interruptible down operation\n\t" - LOCK "decl %1\n\t" /* --sem->count */ + LOCK_PREFIX "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" + "2:\tlea %1,%%eax\n\t" + "call __down_failed_trylock\n\t" "jmp 1b\n" LOCK_SECTION_END :"=a" (result), "=m" (sem->count) - :"c" (sem) + : :"memory"); return result; } @@ -178,17 +173,18 @@ static inline void up(struct semaphore * sem) { __asm__ __volatile__( "# atomic up operation\n\t" - LOCK "incl %0\n\t" /* ++sem->count */ + LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ "jle 2f\n" "1:\n" LOCK_SECTION_START("") - "2:\tcall __up_wakeup\n\t" + "2:\tlea %0,%%eax\n\t" + "call __up_wakeup\n\t" "jmp 1b\n" LOCK_SECTION_END ".subsection 0\n" :"=m" (sem->count) - :"c" (sem) - :"memory"); + : + :"memory","ax"); } #endif