Index: ../linux22-PPS/arch/i386/kernel/time.c =================================================================== RCS file: /root/21REP/linux21/arch/i386/kernel/time.c,v retrieving revision 1.1.1.10.2.4 diff -u -r1.1.1.10.2.4 time.c --- ../linux22-PPS/arch/i386/kernel/time.c 2001/01/03 13:13:38 1.1.1.10.2.4 +++ ../linux22-PPS/arch/i386/kernel/time.c 2001/01/09 21:51:12 @@ -54,8 +54,9 @@ * Improved accuracy and valid range of ``nanodelay_at_last_interrupt'' * as well as ``do_poor_nanotime()''. Fixed conversion from TSC to * nanoseconds. - * 2001-01-03 Ulrich Windl - * Improved accuracy of ``nanodelay_at_last_interrupt''. + * 2001-01-09 Ulrich Windl + * Improved accuracy of ``nanodelay_at_last_interrupt'' and + * ``do_poor_nanotime()''. Fixed bug with clobbered ``jiffies_p''. */ #include @@ -143,7 +144,7 @@ */ __asm__("mull %2" :"=a" (eax), "=d" (edx) - :"g" (exact_microtime_quotient), + :"rm" (exact_microtime_quotient), "0" (eax)); /* our adjusted time offset in microseconds */ @@ -175,7 +176,7 @@ */ __asm__("mull %2" :"=a" (eax), "=d" (edx) - :"g" (exact_nanotime_quotient), + :"rm" (exact_nanotime_quotient), "0" (eax << 4)); /* our adjusted time offset in nanoseconds */ @@ -286,14 +287,16 @@ * Scaling the exact quotient by 2^(32-10) gives 3515231566, * resulting in an overall error of 167.6ns per tick. That is less than * the intrinsic error, so it must be OK. + * As we take the higher 32 bits of the result, the result is too + * small by a factor of 2^10. */ count = (LATCH-1) - count; - jiffies_p = 3515231566UL; /* variable is being misused */ + jiffies_t = 3515231566UL; /* variable is being misused */ __asm__("mull %2" - :"=a" (count), "=d" (jiffies_p) - :"g" (jiffies_p), + :"=a" (count), "=d" (jiffies_t) + :"rm" (jiffies_t), "0" (count)); - return jiffies_p << 10; /* / 2^22 */ + return (jiffies_t << 10) + (count >> 22); #else #error HZ != 100 not implemented #endif @@ -496,7 +499,7 @@ edx = 3515231566UL; __asm__("mull %2" :"=a" (eax), "=d" (edx) - :"g" (edx), + :"rm" (edx), "0" (eax)); nanodelay_at_last_interrupt = (edx << 10) + (eax >> 22);