The ACPI Power Management Timer is "a 24-bit or 32-bit fixed rate free running
count-up timer that runs off a 3.579545 MHz clock" (ACPI specification, section
4.8.3.3; the rate is PMTMR_FREQ). vpmtmr_handler() returned the uptime divided
by that period held as an sbintime_t, and the period, 2^32 / 3579545 = 1199.864
sbintime units, is truncated to 1199 when stored, so the timer runs
1199.864 / 1199 - 1 = 720 ppm fast. A guest that keeps time by the PM timer
gains about a minute a day.
Compute the count as seconds times the frequency, which is exact: split the
32.32 fixed-point delta into its whole and fractional seconds and multiply
each by PMTMR_FREQ.
Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Sponsored by: keelos.dev