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>
This commit is contained in:
Bill Fumerola 2000-03-30 22:39:48 +00:00
parent 2058e7f3e0
commit df38713c24
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58839

View File

@ -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);
}