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: archive/raspbian/4.8.0-1+rpi1~1^2~14883 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=050f66992c7e41cd846b92bffa587816c98baca7;p=xen.git x86: Fix time-scale calculation to avoid #DE fault. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index b00ee01aa3..a9e2b5b735 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -214,6 +214,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; @@ -221,7 +223,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++;