patch-1.3.48 linux/include/asm-mips/delay.h

Next file: linux/include/asm-mips/dma.h
Previous file: linux/include/asm-mips/checksum.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.47/linux/include/asm-mips/delay.h linux/include/asm-mips/delay.h
@@ -27,15 +27,16 @@
 extern __inline__ void udelay(unsigned long usecs)
 {
 	usecs *= 0x000010c6;		/* 2**32 / 1000000 */
-	__asm__("mul\t%0,%0,%1"
+	__asm__("multu\t%0,%1\n\t"
+		"mfhi\t%0"
 		:"=r" (usecs)
 		:"0" (usecs),"r" (loops_per_sec));
 	__delay(usecs);
 }
 
 /*
- * 64-bit integers means we don't have to worry about overflow as
- * on some other architectures..
+ * The different variants for 32/64 bit are pure paranoia. The typical
+ * range of numbers that apprears for MIPS machines avoids overflows.
  */
 extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
 {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this