[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:
2020-07-12 17:43:37 -07:00
parent 794c86f9b4
commit f4cbb9498f
7 changed files with 41 additions and 23 deletions

View File

@@ -14,9 +14,9 @@ clock::clock(uint64_t rate, clock::source source_func, void *data) :
}
void
clock::spinwait(uint64_t ns) const
clock::spinwait(uint64_t us) const
{
uint64_t when = m_source(m_data) + ns;
uint64_t when = m_source(m_data) + us;
while (value() < when);
}