mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[kernel] Fix clock period vs frequency error
Calling `spinwait()` was hanging due to improper computation of the clock rate because justin did a dumb at math. Also the period can be greater than 1ns, so the clock's units were updated to microseconds.
This commit is contained in:
@@ -74,8 +74,7 @@ lapic::calibrate_timer()
|
||||
apic_write(m_base, lapic_timer_init, initial);
|
||||
|
||||
uint64_t us = 200000;
|
||||
uint64_t ns = us * 1000;
|
||||
clock::get().spinwait(ns);
|
||||
clock::get().spinwait(us);
|
||||
|
||||
uint32_t remaining = apic_read(m_base, lapic_timer_cur);
|
||||
uint32_t ticks_total = initial - remaining;
|
||||
|
||||
Reference in New Issue
Block a user