From 9828f35d36d6a7bd040089df2d964d41b113b0ab Mon Sep 17 00:00:00 2001 From: Max Wash Date: Tue, 28 Mar 2023 21:37:24 +0100 Subject: [PATCH] x86_64: fix optimised var read in pit_wait() --- arch/x86_64/pit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86_64/pit.c b/arch/x86_64/pit.c index b6b248a..d8e5cd8 100644 --- a/arch/x86_64/pit.c +++ b/arch/x86_64/pit.c @@ -8,7 +8,6 @@ static unsigned long long tick_counter = 0; static int pit_callback(void) { tick_counter++; - printk("tick"); return 0; } @@ -18,6 +17,8 @@ static irq_hook_t pit_irq_hook = { void pit_start(unsigned int hz) { + tick_counter = 0; + unsigned int divisor = 1193180 / hz; outportb(0x43, 0x36); @@ -49,7 +50,6 @@ void pit_wait(unsigned int ticks) { unsigned long long end = tick_counter + ticks; - while (tick_counter < end) { - ml_cpu_pause(); + while (READ_ONCE(tick_counter) < end) { } }