patch-2.2.11 linux/include/asm-i386/semaphore.h

Next file: linux/include/asm-i386/setup.h
Previous file: linux/include/asm-i386/semaphore-helper.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.10/linux/include/asm-i386/semaphore.h linux/include/asm-i386/semaphore.h
@@ -17,6 +17,10 @@
  *		       potential and subtle race discovered by Ulrich Schmid
  *		       in down_interruptible(). Since I started to play here I
  *		       also implemented the `trylock' semaphore operation.
+ *          1999-07-02 Artur Skawina <skawina@geocities.com>
+ *                     Optimized "0(ecx)" -> "(ecx)" (the assembler does not
+ *                     do this). Changed calling sequences from push/jmp to
+ *                     traditional call/ret.
  *
  * If you would like to see an analysis of this implementation, please
  * ftp to gcom.com and download the file
@@ -63,12 +67,12 @@
 #ifdef __SMP__
 		"lock ; "
 #endif
-		"decl 0(%0)\n\t"
+		"decl (%0)\n\t"     /* --sem->count */
 		"js 2f\n"
 		"1:\n"
 		".section .text.lock,\"ax\"\n"
-		"2:\tpushl $1b\n\t"
-		"jmp __down_failed\n"
+		"2:\tcall __down_failed\n\t"
+		"jmp 1b\n"
 		".previous"
 		:/* no outputs */
 		:"c" (sem)
@@ -84,13 +88,13 @@
 #ifdef __SMP__
 		"lock ; "
 #endif
-		"decl 0(%1)\n\t"
+		"decl (%1)\n\t"     /* --sem->count */
 		"js 2f\n\t"
 		"xorl %0,%0\n"
 		"1:\n"
 		".section .text.lock,\"ax\"\n"
-		"2:\tpushl $1b\n\t"
-		"jmp __down_failed_interruptible\n"
+		"2:\tcall __down_failed_interruptible\n\t"
+		"jmp 1b\n"
 		".previous"
 		:"=a" (result)
 		:"c" (sem)
@@ -107,13 +111,13 @@
 #ifdef __SMP__
 		"lock ; "
 #endif
-		"decl 0(%1)\n\t"
+		"decl (%1)\n\t"     /* --sem->count */
 		"js 2f\n\t"
 		"xorl %0,%0\n"
 		"1:\n"
 		".section .text.lock,\"ax\"\n"
-		"2:\tpushl $1b\n\t"
-		"jmp __down_failed_trylock\n"
+		"2:\tcall __down_failed_trylock\n\t"
+		"jmp 1b\n"
 		".previous"
 		:"=a" (result)
 		:"c" (sem)
@@ -134,12 +138,12 @@
 #ifdef __SMP__
 		"lock ; "
 #endif
-		"incl 0(%0)\n\t"
+		"incl (%0)\n\t"     /* ++sem->count */
 		"jle 2f\n"
 		"1:\n"
 		".section .text.lock,\"ax\"\n"
-		"2:\tpushl $1b\n\t"
-		"jmp __up_wakeup\n"
+		"2:\tcall __up_wakeup\n\t"
+		"jmp 1b\n"
 		".previous"
 		:/* no outputs */
 		:"c" (sem)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)