From 2e62352bc28bd5d3efafc1b5cbe211ff9e9987fd Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 20 Jan 2015 21:07:08 +0100 Subject: [PATCH] * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that no division by 0 occurs. --- ChangeLog | 5 +++++ grub-core/kern/i386/tsc.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) Index: grub-2.02~beta2/grub-core/kern/i386/tsc.c =================================================================== --- grub-2.02~beta2.orig/grub-core/kern/i386/tsc.c +++ grub-2.02~beta2/grub-core/kern/i386/tsc.c @@ -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