patch-2.0.21-2.1.0 linux/include/asm-m68k/delay.h

Next file: linux/include/asm-m68k/errno.h
Previous file: linux/include/asm-m68k/byteorder.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file lx2.0/v2.0.21/linux/include/asm-m68k/delay.h linux/include/asm-m68k/delay.h
@@ -7,13 +7,10 @@
  * Delay routines, using a pre-computed "loops_per_second" value.
  */
 
-extern __inline__ void __delay(int loops)
+extern __inline__ void __delay(unsigned long loops)
 {
-	__asm__ __volatile__ ("\n\tmovel %0,%/d0\n1:\tsubql #1,%/d0\n\t"
-			      "bpls 1b\n"
-		: /* no outputs */
-		: "g" (loops)
-		: "d0");
+	__asm__ __volatile__ ("1: subql #1,%0; jcc 1b"
+		: "=d" (loops) : "0" (loops));
 }
 
 /*
@@ -25,23 +22,22 @@
  */
 extern __inline__ void udelay(unsigned long usecs)
 {
-	usecs *= 0x000010c6;		/* 2**32 / 1000000 */
+	unsigned long tmp;
 
-	__asm__ __volatile__ ("mulul %1,%0:%2"
-	     : "=d" (usecs)
-	     : "d" (usecs),
-	       "d" (loops_per_sec));
+	usecs *= 4295;		/* 2**32 / 1000000 */
+	__asm__ ("mulul %2,%0:%1"
+		: "=d" (usecs), "=d" (tmp)
+		: "d" (usecs), "1" (loops_per_sec));
 	__delay(usecs);
 }
 
 extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
 {
-	__asm__ ("mulul %1,%/d0:%0\n\tdivul %2,%/d0:%0"
-		 :"=d" (a)
-		 :"d" (b),
-		 "d" (c),
-		 "0" (a)
-		 :"d0");
+	unsigned long tmp;
+
+	__asm__ ("mulul %2,%0:%1; divul %3,%0:%1"
+		: "=d" (tmp), "=d" (a)
+		: "d" (b), "d" (c), "1" (a));
 	return a;
 }
 

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