forked from pool/grub2
Marcus Meissner
3ded5cdd6f
- Backport upstream patches for HyperV gen2 TSC timer calbration without RTC (bsc#904647) * added 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch * added 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch * added 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch * added 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch * added 0005-i386-fix-TSC-calibration-using-PIT.patch OBS-URL: https://build.opensuse.org/request/show/355366 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=200
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
|
|
|