diff options
author | Anton Kling <anton@kling.gg> | 2024-07-04 20:00:12 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-07-04 20:00:12 +0200 |
commit | f89eef4733b7905dbf362cbde9aebb2dd0dcfe7d (patch) | |
tree | 3c7a3940c735eaf40a72902552a3be701e2b1d49 /kernel/drivers/pit.c | |
parent | 7d7f0aa9595bedf50083fb89dae049c1f064ca98 (diff) |
PIT: Fix dumb bug
The incorrect timer was being used for TCP ACK flush
Diffstat (limited to 'kernel/drivers/pit.c')
-rw-r--r-- | kernel/drivers/pit.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/drivers/pit.c b/kernel/drivers/pit.c index b8a8aac..9161885 100644 --- a/kernel/drivers/pit.c +++ b/kernel/drivers/pit.c @@ -5,7 +5,6 @@ #define PIT_IO_CHANNEL_0 0x40 #define PIT_IO_MODE_COMMAND 0x43 -u64 clock_num_ms_ticks = 0; u32 pit_counter = 0; u32 switch_counter = 0; u16 hertz; @@ -45,14 +44,16 @@ int last_flush = 0; u64 last_tsc = 0; +extern u64 timer_current_uptime; extern int is_switching_tasks; void int_clock(reg_t *regs) { u64 current_tsc = tsc_get(); + timer_current_uptime = tsc_calculate_ms(current_tsc); random_add_entropy_fast((u8 *)¤t_tsc, sizeof(current_tsc)); switch_counter++; - if (clock_num_ms_ticks - last_flush > 50) { + if (timer_current_uptime - last_flush > 50) { tcp_flush_acks(); - last_flush = clock_num_ms_ticks; + last_flush = timer_current_uptime; } if (switch_counter >= hertz) { EOI(0x20); |