Timer calculation for hypervisor

nick <[email protected]> Sun, 17 Jul 2022 02:20:44 +0300
Newsgroups gmane.comp.emulators.bochs.devel
Message-ID <[email protected]>
Greetings,

I am doing a fun project, where I am replacing the cpu emulator of bochs 
with a hypervisor(intel vmx).

There are virtual devices, like the keyboard controller, that are using 
a timer for certain events.

The way I am handling it with the hypervisor is to use a vmx timer 
exit(VMX-preemption timer) every couple nanoseconds and then handle it 
in bochs by calling `bx_pc_system.tickn(timer)`.

I noticed that there is a significant execution delay based on the value 
of the timers. I was wondering what is the right way to calculate the 
timer for the fastest execution(both the VMX and the value in bochs).

My cpu is `i7-6700K CPU @ 4.00GHz` if that somehow helps with the 
calculation.

Thank you,