* grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0.
This commit is contained in:
parent
2e62352bc2
commit
b666e01b9c
2 changed files with 9 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0.
|
||||||
|
|
||||||
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that
|
* grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that
|
||||||
|
|
|
@ -126,7 +126,7 @@ guessfsb (void)
|
||||||
{
|
{
|
||||||
const grub_uint64_t sane_value = 100000000;
|
const grub_uint64_t sane_value = 100000000;
|
||||||
grub_uint32_t manufacturer[3], max_cpuid, capabilities, msrlow;
|
grub_uint32_t manufacturer[3], max_cpuid, capabilities, msrlow;
|
||||||
grub_uint32_t a, b, d;
|
grub_uint32_t a, b, d, divisor;
|
||||||
|
|
||||||
if (! grub_cpu_is_cpuid_supported ())
|
if (! grub_cpu_is_cpuid_supported ())
|
||||||
return sane_value;
|
return sane_value;
|
||||||
|
@ -166,8 +166,10 @@ guessfsb (void)
|
||||||
r = (2000ULL << 32) - v * grub_tsc_rate;
|
r = (2000ULL << 32) - v * grub_tsc_rate;
|
||||||
v += r / grub_tsc_rate;
|
v += r / grub_tsc_rate;
|
||||||
|
|
||||||
return grub_divmod64 (v, ((msrlow >> 7) & 0x3e) | ((msrlow >> 14) & 1),
|
divisor = ((msrlow >> 7) & 0x3e) | ((msrlow >> 14) & 1);
|
||||||
0);
|
if (divisor == 0)
|
||||||
|
return sane_value;
|
||||||
|
return grub_divmod64 (v, divisor, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct property_descriptor
|
struct property_descriptor
|
||||||
|
|
Loading…
Reference in a new issue