ia64/linux-2.6.18-xen.hg

changeset 559:446c39a967fc

xen: Do not allow gcc-3.4 to turn loop on a 64-bit variable into
64-bit division, which the kernel does not support.

Signed-off-by: Guillaume Rousse <guillaume.rousse@inria.fr>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed May 21 17:04:37 2008 +0100 (2008-05-21)
parents 1e8c3287b395
children 936f6dd9d49c
files arch/i386/kernel/time-xen.c
line diff
     1.1 --- a/arch/i386/kernel/time-xen.c	Wed May 21 11:11:00 2008 +0100
     1.2 +++ b/arch/i386/kernel/time-xen.c	Wed May 21 17:04:37 2008 +0100
     1.3 @@ -137,13 +137,21 @@ static void __clock_was_set(void *unused
     1.4  }
     1.5  static DECLARE_WORK(clock_was_set_work, __clock_was_set, NULL);
     1.6  
     1.7 +/*
     1.8 + * GCC 4.3 can turn loops over an induction variable into division. We do
     1.9 + * not support arbitrary 64-bit division, and so must break the induction.
    1.10 + */
    1.11 +#define clobber_induction_variable(v) asm ( "" : "+r" (v) )
    1.12 +
    1.13  static inline void __normalize_time(time_t *sec, s64 *nsec)
    1.14  {
    1.15  	while (*nsec >= NSEC_PER_SEC) {
    1.16 +		clobber_induction_variable(*nsec);
    1.17  		(*nsec) -= NSEC_PER_SEC;
    1.18  		(*sec)++;
    1.19  	}
    1.20  	while (*nsec < 0) {
    1.21 +		clobber_induction_variable(*nsec);
    1.22  		(*nsec) += NSEC_PER_SEC;
    1.23  		(*sec)--;
    1.24  	}