1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

Kernel: Fix APIC timer calibration to be more accurate

We were calibrating it to 260 instead of 250 ticks per second (being
off by one for the 1/10th second calibration time), resulting in
ticks of only ~3.6 ms instead of ~4ms. This gets us closer to ~4ms,
but because the APIC isn't nearly as precise as e.g. HPET, it will
only be a best effort. Then, use the higher precision reference
timer to more accurately calculate how many ticks we actually get
each second.

Also the frequency calculation was off, causing a "Frequency too slow"
error with VMware.

Fixes some problems observed in #5539
This commit is contained in:
Tom 2021-02-28 11:47:03 -07:00 committed by Andreas Kling
parent f66adbdd95
commit cdbd878a14
7 changed files with 64 additions and 23 deletions

View file

@ -65,6 +65,9 @@ public:
virtual void set_non_periodic() = 0;
virtual void disable() = 0;
virtual u32 frequency() const = 0;
virtual bool can_query_raw() const { return false; }
virtual u64 current_raw() const { return 0; }
virtual u64 raw_to_ns(u64) const { return 0; }
virtual size_t ticks_per_second() const = 0;