]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
x86: Fix time-scale calculation to avoid #DE fault.
authorKeir Fraser <keir@xensource.com>
Thu, 11 Oct 2007 18:23:40 +0000 (19:23 +0100)
committerKeir Fraser <keir@xensource.com>
Thu, 11 Oct 2007 18:23:40 +0000 (19:23 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen-unstable changeset:   16098:f6a06b2eefc5931a9cd9ec71baec94d67fe06909
xen-unstable date:        Thu Oct 11 19:23:40 2007 +0100

xen/arch/x86/time.c

index 78fe1d4bf240e7cb676d24557f3d573032b3b671..62df2bc3a87cc352b2e00c74742cc9fd57082c7a 100644 (file)
@@ -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++;