patch-2.1.125 linux/arch/i386/lib/delay.c

Next file: linux/arch/i386/mm/fault.c
Previous file: linux/arch/i386/kernel/smp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.124/linux/arch/i386/lib/delay.c linux/arch/i386/lib/delay.c
@@ -5,7 +5,9 @@
  *	Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
  *
  *	The __delay function must _NOT_ be inlined as its execution time
- *	depends wildly on alignment on many x86 processors.
+ *	depends wildly on alignment on many x86 processors. The additional
+ *	jump magic is needed to get the timing stable on all the CPU's
+ *	we have to worry about.
  */
 
 #include <linux/sched.h>
@@ -18,7 +20,11 @@
 void __delay(unsigned long loops)
 {
 	__asm__ __volatile__(
- 		"1:\tdecl %0\n\tjns 1b"
+		"\tjmp 1f\n"
+		".align 16\n"
+		"1:\tjmp 2f\n"
+		".align 16\n"
+		"2:\tdecl %0\n\tjns 2b"
 		:/* no outputs */
 		:"a" (loops)
 		:"ax");

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov