From a950021011e41b7d4fd285dde278cf9b06f89574 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Wed, 20 Mar 2024 18:08:57 +0100 Subject: MMU: Fixed massive problem in assumption of RAM layout This caused certain addreses which where not RAM memory to be assigned to virtual addresses incorrectly. This caused a significant slowdown when running it with KVM due to constantly having to exit the VM if the OS writes to memory that is not RAM. This fix increased the performance of KVM significantly and improved TCG performance. --- kernel/drivers/pit.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'kernel/drivers') diff --git a/kernel/drivers/pit.c b/kernel/drivers/pit.c index 30fd3ed..41c0d2a 100644 --- a/kernel/drivers/pit.c +++ b/kernel/drivers/pit.c @@ -44,16 +44,14 @@ void set_pit_count(u16 _hertz) { } void int_clock(reg_t *regs) { - EOI(0x20); - pit_counter++; - if (pit_counter * 1000 >= hertz) { - pit_counter = 0; - clock_num_ms_ticks += 1000 / hertz; - } + clock_num_ms_ticks++; switch_counter++; - if (switch_counter * 500 >= hertz) { + if (switch_counter >= hertz) { + EOI(0x20); switch_counter = 0; switch_task(); + } else { + EOI(0x20); } } -- cgit v1.2.3