kernel
kernel copied to clipboard
Timer via TSC
The kernel should be able to at least time itself using the TSC as defined in the Intel manuals. Though I believed the formulas from EDK II were correct, testing has revealed that they are not, so we need to figure out an alternative. LAPIC support, per issue #4, should preferably be a fallback.
The most difficult part of this task is identifying the formulas to use. The TSC is a monotonic 64-bit incrimenting counter, and does not have any actual units other than CPU cycles, so we need to identify how many TSC ticks are within a unit of time such as a nanosecond. To do that, though, we need the LAPIC, but for that we first need to fix the paging issues.