#2393 closed defect (duplicate)
Timer stalls in mode 2
Reported by: | ncafferkey | Owned by: | |
---|---|---|---|
Component: | other | Version: | VirtualBox 2.0.2 |
Keywords: | timer PIT | Cc: | |
Guest type: | other | Host type: | Mac OS X |
Description
When the emulated timer runs in mode 2, it counts down from its initial value to 1, but does not then reload the initial value. Instead, it stays at 1.
This behaviour prevents AROS (http://www.aros.org) from booting under VBox.
This is the code used by AROS to initialise the timer:
/* Start the timer2 */
outb((inb(0x61) & 0xfd) | 1, 0x61); /* Enable the timer (set GATE on) */
outb(0xb4, 0x43); /* Binary mode on Timer2, count mode 2 */
outb(0x00, 0x42); /* We're counting whole range */
outb(0x00, 0x42);
And this is the code used to read the timer's value:
/* Latch the current time value */
outb(0x80, 0x43);
/* Read out current 16-bit time */
time = inb(0x42);
time += inb(0x42) << 8;
This works on real machines and on several other emulators. I don't know if it's much different from what other OSs do.
This is a duplicate of #916.