Add code to the BIOS VM86 emulator to detect writes to the 8254. If a
authorMatthew Dillon <dillon@dragonflybsd.org>
Sat, 20 Nov 2004 20:25:13 +0000 (20:25 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sat, 20 Nov 2004 20:25:13 +0000 (20:25 +0000)
commit0d1dffdf67f773448571bda0795b5b394ec642ba
tree625def1429f04f55a65bd9685b80915970e9d773
parentacc30fdb0658f609e2721c1f1b42d242d90f9381
Add code to the BIOS VM86 emulator to detect writes to the 8254.  If a
write is detected the 8254 is reset after the bios call returns and the
event is reported.  Some bioses, in particular video bioses, uses timer 2
for timing things.  We need timer 2 for our master clock.

Remove restoreclocks().  This was causing gd_cpuclock_base to reverse index
and jump the time ahead an hour with a flurry of hardclock interrupts.

Introduce a new systimer API call, systimer_init_periodic_nq(), which
installs a non-queued periodic systimer.  Non-queued means that if multiple
events built-up (due to an 8254 glitch, sleep, or other event), only one
event will be reported.

This should fix the BIOS/8254 glitching, the 'hour jump' problem, and
hopefully other timer jumping issues as well.

Bugs-reported-by: Andreas Hauser <andy@splashground.de>,
Jonathon McKitrick <jcm@FreeBSD-uk.eu.org>,
and others
sys/i386/i386/vm86.c
sys/i386/isa/clock.c
sys/kern/kern_clock.c
sys/kern/kern_systimer.c
sys/platform/pc32/i386/vm86.c
sys/platform/pc32/isa/clock.c
sys/sys/systimer.h
sys/sys/time.h