bochs hpet frequency

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.
Post Reply
uglyoldbob
Member
Member
Posts: 63
Joined: Tue Feb 13, 2007 10:46 am

bochs hpet frequency

Post by uglyoldbob »

Hello,

I am writing some basic timing tests using the hpet channel 0.
I noticed some very different timing results on qemu vs bochs.

Both qemu and bochs report 10,000,000 as the period for the hpet.
In my timing loop, I read the current counter value, add a constant to it (calculated to be 100,000,000 for 1 second), and then wait until the counter value exceeds that. (Not the best because it doesn't account for overflow, but it will do for now).

In qemu, I get delays that look like 1 second.
In bochs, I get delays that look like 0.1 second (I have to change the delay to 10 seconds to get a 1 second delay).

I print the counter value before and after my delay, along with the calculated number of ticks. The before and after values show the correct number of ticks has passed.
The below print shows a few hpet registers, the current/future counter value, then the actual final counter value for the hpet.

Code: Select all

HPET NEEDS 100000000 TICKS FOR 1000 ms
HPET CHANNEL CONFIG IS ffffff00000034
HPET GENERAL CONFIG IS 1
HPET GENERAL COUNTER IS 1439648800/1535764700
HPET GENERAL COUNTER IS 1535806150
Based on what I am seeing, the period for bochs should be only 1,000,000 instead of 10,000,000.

Anybody know if this is expected behavior on bochs?
Octocontrabass
Member
Member
Posts: 6245
Joined: Mon Mar 25, 2013 7:01 pm

Re: bochs hpet frequency

Post by Octocontrabass »

Yeah, that sounds normal for Bochs. According to the manual, there are settings you can change to make it behave more like QEMU.
Post Reply