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 Approved by: re@ (cperciva) (cherry picked from commit499171a98c
) (cherry picked from commita1c63b8e29
)
This commit is contained in:
parent
572900bd93
commit
55639067a2
@ -1027,7 +1027,7 @@ lapic_calibrate_initcount_cpuid_vm(void)
|
|||||||
|
|
||||||
/* Record divided frequency. */
|
/* Record divided frequency. */
|
||||||
count_freq = freq / lapic_timer_divisor;
|
count_freq = freq / lapic_timer_divisor;
|
||||||
return (true);
|
return (count_freq != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t
|
static uint64_t
|
||||||
|
Loading…
Reference in New Issue
Block a user