diff options
author | billf <billf@FreeBSD.org> | 2000-03-30 22:39:48 +0000 |
---|---|---|
committer | billf <billf@FreeBSD.org> | 2000-03-30 22:39:48 +0000 |
commit | 4431d75b8dcd0a372af27021337ea790e222cdc2 (patch) | |
tree | 8e397eeac0716d3c94b28e41474bb643c0c73bfd /sys | |
parent | cbdf327160c5f9ba8f2b047a4cf99b64688dbc7a (diff) | |
download | FreeBSD-src-4431d75b8dcd0a372af27021337ea790e222cdc2.zip FreeBSD-src-4431d75b8dcd0a372af27021337ea790e222cdc2.tar.gz |
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>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/alpha/clock.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/alpha/alpha/clock.c b/sys/alpha/alpha/clock.c index e320aba..ececbeb 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); } |