* grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that

no division by 0 occurs.
This commit is contained in:
Vladimir Serbinenko committed 2015-01-21 17:42:14 +01:00
1 parent e360b5d176
commit 2e62352bc2
2 files changed
+10 -1

No files matched your search

+5 -1
View File
@@ -122,7 +122,11 @@ calibrate_tsc (void)
grub_pit_wait (0xffff);
end_tsc = grub_get_tsc ();
grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0);
grub_tsc_rate = 0;
if (end_tsc > tsc_boot_time)
grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0);
if (grub_tsc_rate == 0)
grub_tsc_rate = 5368;/* 800 MHz */
}
#endif