The PIT and VirtualBox

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: The PIT and VirtualBox

Post by Korona »

Try the following snippet:

Code: Select all

void timer_set_freq(uint16 freq) {
   uint32 divisor = 1193180 / freq;

   outb(0x43, 0x34); // according to the wiki this byte should be 34 and not 36
   outb(0x40, divisor & 0xFF);
   outb(0x40, (divisor >> 8) & 0xFF);
}
It's possible that virtualbox cannot emulate all PIT operating modes; I guess it only emulates the most common modes.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Post Reply