bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH gnumach] ioapic: Timer calibrated in 10 mach ticks


From: Damien Zammit
Subject: [PATCH gnumach] ioapic: Timer calibrated in 10 mach ticks
Date: Sat, 11 Mar 2023 07:29:45 +0000

hz variable is the number of mach ticks in 1 second.
We want to know how many lapic ticks in 1 mach tick.
Therefore, we set a timer for 10 mach ticks and divide
the lapic stopwatch counter value by 10.
---
 i386/i386at/ioapic.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/i386/i386at/ioapic.c b/i386/i386at/ioapic.c
index c6da35e1..73fd216a 100644
--- a/i386/i386at/ioapic.c
+++ b/i386/i386at/ioapic.c
@@ -172,8 +172,8 @@ timer_measure_10x_apic_hz(void)
     /* Set APIC timer */
     lapic->init_count.r = start;

-    /* Delay for 10 * 1/hz seconds */
-    set_timeout(&tmp_timer, hz / 10);
+    /* Delay for 10 ticks (10 * 1/hz seconds) */
+    set_timeout(&tmp_timer, 10);
     do {
         cpu_pause();
     } while (!done);
@@ -195,9 +195,8 @@ calibrate_lapic_timer(void)
     lapic->divider_config.r = LAPIC_TIMER_DIVIDE_2;
     lapic->lvt_timer.r = IOAPIC_INT_BASE;

-    /* Measure number of APIC timer ticks in 10x 1/hz seconds
-     * but calibrate the timer to expire at rate of hz
-     * divide by 10 because we waited 10 times longer than we needed. */
+    /* Measure number of APIC timer ticks in 10 mach ticks
+     * divide by 10 because we want to know how many in 1 tick */
     if (!calibrated_ticks) {
         s = splhigh();
         spl0();
--
2.39.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]