mm: kill current task on usermode pagefault and fix destroy_page_dir destroying kernel space mappings

This commit is contained in:
2026-04-16 15:19:12 +03:00
parent 64d5cd1d2f
commit ab2da499da
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -101,6 +101,13 @@ void handle_page_fault(uint32_t error_code, uint32_t faulting_address)
printf("ERR: 0x%X\n", error_code); printf("ERR: 0x%X\n", error_code);
if (user) {
printf("page fault, killing task %x\n", current->pid);
task_kill(current);
asm volatile("sti");
while (1) {}
}
asm("hlt"); asm("hlt");
} }
+1 -1
View File
@@ -169,7 +169,7 @@ void destroy_page_dir(uint32_t* page_dir_virt) {
// Iterate through user-space page directory entries (PDEs 0-767). // Iterate through user-space page directory entries (PDEs 0-767).
// Kernel space (768+) is shared and should not be freed. // Kernel space (768+) is shared and should not be freed.
for (int i = 0; i < 768; i++) { for (int i = 1; i < 768; i++) {
uint32_t pde = page_dir_virt[i]; uint32_t pde = page_dir_virt[i];
// Check if the page directory entry is present // Check if the page directory entry is present