forked from pool/grub2
e5cdbc55b8
1 OBS-URL: https://build.opensuse.org/request/show/355410 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=131
29 lines
995 B
Diff
29 lines
995 B
Diff
From 2e62352bc28bd5d3efafc1b5cbe211ff9e9987fd Mon Sep 17 00:00:00 2001
|
|
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
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
|
|
|