mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 00:33:30 +00:00
apic: prevent divide by zero in CPU frequency init
If a CPU for some reason returns 0 as CPU frequency, we currently panic
on the resulting divide by zero when trying to initialize the CPU(s) via
APIC. When this happens, we'll fallback to measuring the frequency
instead.
PR: 269767
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/664
(cherry picked from commit 499171a98c
)
This commit is contained in:
parent
3464fc5f2a
commit
a1c63b8e29
@ -1027,7 +1027,7 @@ lapic_calibrate_initcount_cpuid_vm(void)
|
||||
|
||||
/* Record divided frequency. */
|
||||
count_freq = freq / lapic_timer_divisor;
|
||||
return (true);
|
||||
return (count_freq != 0);
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
|
Loading…
Reference in New Issue
Block a user