Expand description
Boot timestamp : TSC-based elapsed time from kernel entry.
Captures rdtsc() at the very start of kernel_main and exposes
elapsed_ms() / elapsed_us() for boot milestone logging.
Before APIC timer calibration the TSC frequency is unknown, so we
use a conservative default (2 GHz). Call calibrate() once the
real frequency is known to get accurate readings.
Staticsยง
- BOOT_
TSC ๐ - TSC value captured at kernel entry.
- TSC_KHZ ๐
- TSC frequency in KHz. Default 2_000_000 KHz (= 2 GHz) until calibrated.
Functionsยง
- calibrate
- Refine TSC frequency after timer calibration.
- calibrate_
khz - Set TSC frequency directly (used for CPUID leaf 0x15 calibration).
- elapsed_
ms - Milliseconds elapsed since kernel entry.
- elapsed_
tsc ๐ - TSC ticks elapsed since
init(). - elapsed_
us - Microseconds elapsed since kernel entry.
- init
- Capture the boot TSC. Must be called once, as early as possible.
- tsc_khz
- Current TSC frequency in KHz (for external conversions).