mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09: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:
parent
f66adbdd95
commit
cdbd878a14
Notes:
sideshowbarker
2024-07-18 21:50:04 +09:00
Author: https://github.com/tomuta
Commit: cdbd878a14
Pull-request: https://github.com/SerenityOS/serenity/pull/5563
7 changed files with 64 additions and 23 deletions
|
@ -71,7 +71,7 @@ UNMAP_AFTER_INIT KernelRng::KernelRng()
|
|||
klog() << "KernelRng: Using HPET as entropy source";
|
||||
|
||||
for (size_t i = 0; i < resource().pool_count * resource().reseed_threshold; ++i) {
|
||||
u64 hpet_time = HPET::the().read_main_counter();
|
||||
u64 hpet_time = HPET::the().read_main_counter_unsafe();
|
||||
this->resource().add_random_event(hpet_time, i % 32);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue