1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 10:55:06 +00:00

Fix dumb-but-hard-to-find bug in paging.

This was the fix:

-process.m_page_directory[0] = m_kernel_page_directory[0];
-process.m_page_directory[1] = m_kernel_page_directory[1];
+process.m_page_directory->entries[0] = m_kernel_page_directory->entries[0];
+process.m_page_directory->entries[1] = m_kernel_page_directory->entries[1];

I spent a good two hours scratching my head, not being able to figure out why
user process page directories felt they had ownership of page tables in the
kernel page directory.

It was because I was copying the entire damn kernel page directory into
the process instead of only sharing the two first PDE's. Dang!
This commit is contained in:
Andreas Kling 2018-11-03 00:31:42 +01:00
parent 8accc92c3c
commit b59ce22fc5
5 changed files with 113 additions and 38 deletions

View file

@ -79,7 +79,7 @@ void* kmalloc_eternal(size_t size)
void* kmalloc_page_aligned(size_t size)
{
ASSERT((size % 4096) == 0);
ASSERT((size % PAGE_SIZE) == 0);
void* ptr = s_next_page_aligned_ptr;
s_next_page_aligned_ptr += size;
ASSERT(s_next_page_aligned_ptr < s_end_of_page_aligned_range);