ia64/xen-unstable

changeset 2751:35abe76a49b1

bitkeeper revision 1.1159.1.289 (417fb030yj7vBz8Pvd4b0uvFxr0PzQ)

Ensure we use 64-bit arithmetic when converting a possibly-large
microseconds value into a nanoseconds value (e.g., when calculating
current system time in the timer interrupt handler).
author kaf24@freefall.cl.cam.ac.uk
date Wed Oct 27 14:26:56 2004 +0000 (2004-10-27)
parents d787d8fcc4d3
children 8a95c46fe237 8d83a86ca86b
files linux-2.4.27-xen-sparse/arch/xen/kernel/time.c linux-2.6.9-xen-sparse/arch/xen/i386/kernel/time.c
line diff
     1.1 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c	Wed Oct 27 13:32:42 2004 +0000
     1.2 +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c	Wed Oct 27 14:26:56 2004 +0000
     1.3 @@ -397,7 +397,7 @@ static inline void do_timer_interrupt(in
     1.4          __get_time_values_from_xen();
     1.5          
     1.6          delta = (s64)(shadow_system_time + 
     1.7 -                      (__get_time_delta_usecs() * 1000) -
     1.8 +                      ((s64)__get_time_delta_usecs() * 1000LL) -
     1.9                        processed_system_time);
    1.10      }
    1.11      while ( !TIME_VALUES_UP_TO_DATE );
     2.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/time.c	Wed Oct 27 13:32:42 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/time.c	Wed Oct 27 14:26:56 2004 +0000
     2.3 @@ -273,7 +273,8 @@ int do_settimeofday(struct timespec *tv)
     2.4  	 * be stale, so we can retry with fresh ones.
     2.5  	 */
     2.6   again:
     2.7 -	nsec = tv->tv_nsec - cur_timer->get_offset() * NSEC_PER_USEC;
     2.8 +	nsec = (s64)tv->tv_nsec -
     2.9 +	    ((s64)cur_timer->get_offset() * (s64)NSEC_PER_USEC);
    2.10  	if (unlikely(!TIME_VALUES_UP_TO_DATE)) {
    2.11  		__get_time_values_from_xen();
    2.12  		goto again;
    2.13 @@ -383,15 +384,16 @@ static inline void do_timer_interrupt(in
    2.14  		__get_time_values_from_xen();
    2.15  
    2.16  		delta = (s64)(shadow_system_time +
    2.17 -			      (cur_timer->get_offset() * NSEC_PER_USEC) -
    2.18 +			      ((s64)cur_timer->get_offset() * 
    2.19 +			       (s64)NSEC_PER_USEC) -
    2.20  			      processed_system_time);
    2.21  	}
    2.22  	while (!TIME_VALUES_UP_TO_DATE);
    2.23  
    2.24  	if (unlikely(delta < 0)) {
    2.25 -		printk("Timer ISR: Time went backwards: %lld %lld %ld %lld\n",
    2.26 +		printk("Timer ISR: Time went backwards: %lld %lld %lld %lld\n",
    2.27  		       delta, shadow_system_time,
    2.28 -		       (cur_timer->get_offset() * NSEC_PER_USEC), 
    2.29 +		       ((s64)cur_timer->get_offset() * (s64)NSEC_PER_USEC), 
    2.30  		       processed_system_time);
    2.31  		return;
    2.32  	}