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/includes/mmu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kernel/includes') diff --git a/kernel/includes/mmu.h b/kernel/includes/mmu.h index 68fd134..1a3f7c9 100644 --- a/kernel/includes/mmu.h +++ b/kernel/includes/mmu.h @@ -1,6 +1,7 @@ #ifndef PAGING_H #define PAGING_H #include "kmalloc.h" +#include #include typedef u8 mmu_flags; @@ -49,7 +50,7 @@ void *mmu_is_valid_userpointer(const void *ptr, size_t s); void *mmu_is_valid_user_c_string(const char *ptr, size_t *size); void flush_tlb(void); -void paging_init(u64 memsize); +void paging_init(u64 memsize, multiboot_info_t *mb); PageDirectory *get_active_pagedirectory(void); void move_stack(u32 new_stack_address, u32 size); void switch_page_directory(PageDirectory *directory); @@ -58,6 +59,7 @@ PageDirectory *clone_directory(PageDirectory *original); void *virtual_to_physical(void *address, PageDirectory *directory); void *ksbrk(size_t s); void *ksbrk_physical(size_t s, void **physical); +void write_to_frame(u32 frame_address, u8 on); Page *get_page(void *ptr, PageDirectory *directory, int create_new_page, int set_user); -- cgit v1.2.3