diff options
author | sobomax <sobomax@FreeBSD.org> | 2008-10-26 18:58:04 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2008-10-26 18:58:04 +0000 |
commit | c1e5c07e0b3ab1e70aa1fd6bca55b52c50b074f9 (patch) | |
tree | 11afa02b3d6e8e43e8a8896458949eabce92054a /sys/amd64 | |
parent | 7c44fbc5ad6cb8f042ab3d179beb42444d9ff3fb (diff) | |
download | FreeBSD-src-c1e5c07e0b3ab1e70aa1fd6bca55b52c50b074f9.zip FreeBSD-src-c1e5c07e0b3ab1e70aa1fd6bca55b52c50b074f9.tar.gz |
Fix division by zero panic if kern.hz less than 32.
MFC after: 1 day
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/local_apic.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/amd64/amd64/local_apic.c b/sys/amd64/amd64/local_apic.c index 7f31e1c..30ab41f 100644 --- a/sys/amd64/amd64/local_apic.c +++ b/sys/amd64/amd64/local_apic.c @@ -401,7 +401,11 @@ lapic_setup_clock(void) lapic_timer_hz = hz * 2; else lapic_timer_hz = hz * 4; - stathz = lapic_timer_hz / (lapic_timer_hz / 128); + if (lapic_timer_hz < 128) { + stathz = 128; + } else { + stathz = lapic_timer_hz / (lapic_timer_hz / 128); + } profhz = lapic_timer_hz; lapic_timer_period = value / lapic_timer_hz; |