x86_64: fix optimised var read in pit_wait()

This commit is contained in:
2023-03-28 21:37:24 +01:00
parent 474878911b
commit 9828f35d36

View File

@@ -8,7 +8,6 @@ static unsigned long long tick_counter = 0;
static int pit_callback(void) static int pit_callback(void)
{ {
tick_counter++; tick_counter++;
printk("tick");
return 0; return 0;
} }
@@ -18,6 +17,8 @@ static irq_hook_t pit_irq_hook = {
void pit_start(unsigned int hz) void pit_start(unsigned int hz)
{ {
tick_counter = 0;
unsigned int divisor = 1193180 / hz; unsigned int divisor = 1193180 / hz;
outportb(0x43, 0x36); outportb(0x43, 0x36);
@@ -49,7 +50,6 @@ void pit_wait(unsigned int ticks)
{ {
unsigned long long end = tick_counter + ticks; unsigned long long end = tick_counter + ticks;
while (tick_counter < end) { while (READ_ONCE(tick_counter) < end) {
ml_cpu_pause();
} }
} }