summaryrefslogtreecommitdiff
path: root/kern/mach_clock.h
diff options
context:
space:
mode:
authorZhaoming Luo <zhmingluo@163.com>2025-03-24 12:25:51 +0800
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-03-25 01:11:12 +0100
commit6d91c78f0c240e3c7d81e19e85507e0aec580d6f (patch)
treeaf612893bc051a0725d71154769896c50c3a251e /kern/mach_clock.h
parentd8fd7d256e412d3b19f7f2291ae95fbb0f6794ec (diff)
Integrate HPET so the functions used for getting time can have a higher accuracy
Integrate HPET so host_get_time, host_get_time64, and host_get_uptime64 are more precise. The highest precision can be 10ns when this patch is applied. * i386/i386/apic.c: Implement the two high-precision clock interface functions added in this patch for i386. * i386/i386at/model_dep.c: Initialize HPET if APIC is defined * kern/mach_clock.c: Integrate the high-precision clocks to have the 10ns precise time values. * kern/mach_clock.h: Add two new interface functions for accessing the high-precision clocks. Message-ID: <20250324042551.4752-2-zhmingluo@163.com>
Diffstat (limited to 'kern/mach_clock.h')
-rw-r--r--kern/mach_clock.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/kern/mach_clock.h b/kern/mach_clock.h
index d4f04f5e..e83b638c 100644
--- a/kern/mach_clock.h
+++ b/kern/mach_clock.h
@@ -110,4 +110,8 @@ extern boolean_t untimeout(timer_func_t *fcn, const void *param);
extern int timeopen(dev_t dev, int flag, io_req_t ior);
extern void timeclose(dev_t dev, int flag);
+/* For high-precision clocks. */
+extern uint32_t hpclock_read_counter(void);
+extern uint32_t hpclock_get_counter_period_nsec(void);
+
#endif /* _KERN_MACH_CLOCK_H_ */