aboutsummaryrefslogtreecommitdiff
path: root/sys/alpha
diff options
context:
space:
mode:
authorBill Fumerola <billf@FreeBSD.org>2000-03-30 22:39:48 +0000
committerBill Fumerola <billf@FreeBSD.org>2000-03-30 22:39:48 +0000
commitdf38713c24f2b7f23d5032235af3f959e695ac8f (patch)
tree46aba01c693a208474a2f33e900fe044c32ffe8d /sys/alpha
parent2058e7f3e0f064152861a58a829a0f42c2afdeca (diff)
downloadsrc-df38713c24f2b7f23d5032235af3f959e695ac8f.tar.gz
src-df38713c24f2b7f23d5032235af3f959e695ac8f.zip
Avoid dividing by zero when beeping with a zero pitch. This was bad.
PR: alpha/17637 Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reported by: Dennis Lindroos <lindroos@nls.fi>
Notes
Notes: svn path=/head/; revision=58839
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/clock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/alpha/alpha/clock.c b/sys/alpha/alpha/clock.c
index e320abac3f08..ececbebbb78b 100644
--- a/sys/alpha/alpha/clock.c
+++ b/sys/alpha/alpha/clock.c
@@ -496,12 +496,14 @@ sysbeep(int pitch, int period)
splx(x);
return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */
}
- pitch = TIMER_DIV(pitch);
+
+ if (pitch) pitch = TIMER_DIV(pitch);
+
outb(TIMER_CNTR2, pitch);
outb(TIMER_CNTR2, (pitch>>8));
if (!beeping) {
/* enable counter2 output to speaker */
- outb(IO_PPI, inb(IO_PPI) | 3);
+ if (pitch) outb(IO_PPI, inb(IO_PPI) | 3);
beeping = period;
timeout(sysbeepstop, (void *)NULL, period);
}