8c6b1ac71e
Also include some minor fixes for gcc 5.1.1 Signed-off-by: Peter Jones <pjones@redhat.com>
47 lines
1.4 KiB
Diff
47 lines
1.4 KiB
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 162/506] * 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(-)
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
index ecbe11d..c2551db 100644
|
|
--- a/ChangeLog
|
|
+++ b/ChangeLog
|
|
@@ -1,5 +1,10 @@
|
|
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
|
+ * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that
|
|
+ no division by 0 occurs.
|
|
+
|
|
+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
|
+
|
|
* include/grub/misc.h (grub_div_roundup): Remove as it's unused.
|
|
|
|
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
|
diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c
|
|
index 3a4cae6..d7d1783 100644
|
|
--- a/grub-core/kern/i386/tsc.c
|
|
+++ b/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
|
|
|
|
--
|
|
2.4.3
|
|
|