From: Keir Fraser Date: Thu, 11 Oct 2007 18:23:40 +0000 (+0100) Subject: x86: Fix time-scale calculation to avoid #DE fault. X-Git-Tag: 3.1.2-rc1~14 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=50c12d81de521f1b20a855a75114afbd003ba9aa;p=people%2Fvhanquez%2Fxen.git x86: Fix time-scale calculation to avoid #DE fault. Signed-off-by: Keir Fraser xen-unstable changeset: 16098:f6a06b2eefc5931a9cd9ec71baec94d67fe06909 xen-unstable date: Thu Oct 11 19:23:40 2007 +0100 --- diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 78fe1d4bf..62df2bc3a 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -215,6 +215,8 @@ static void set_time_scale(struct time_scale *ts, u64 ticks_per_sec) u32 tps32; int shift = 0; + ASSERT(tps64 != 0); + while ( tps64 > (MILLISECS(1000)*2) ) { tps64 >>= 1; @@ -222,7 +224,7 @@ static void set_time_scale(struct time_scale *ts, u64 ticks_per_sec) } tps32 = (u32)tps64; - while ( tps32 < (u32)MILLISECS(1000) ) + while ( tps32 <= (u32)MILLISECS(1000) ) { tps32 <<= 1; shift++;