summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-10-12 16:24:32 +0200
committerAnton Kling <anton@kling.gg>2024-10-12 16:26:34 +0200
commitedca64134a9873f32379b2b83bd925ecca1c19b1 (patch)
tree2030941a03c782ab3d56211461f5bce76f7cccf0 /kernel
parent01281bfbf523a80edad7999bb471104e8f43e2da (diff)
Kernel/MMU: Don't return non present pages unless creation is desired
`get_page` is a horrible multipurpose function and at this point I am unsure what behavior I expect and have expected it to produce. Refactor should probably be done soon.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/arch/i386/mmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/arch/i386/mmu.c b/kernel/arch/i386/mmu.c
index c38d834..a59eccf 100644
--- a/kernel/arch/i386/mmu.c
+++ b/kernel/arch/i386/mmu.c
@@ -127,6 +127,9 @@ Page *get_page(void *ptr, PageDirectory *directory, int create_new_page,
}
}
Page *p = &directory->tables[table_index]->pages[address % 1024];
+ if (!p->present && !create_new_page) {
+ return 0;
+ }
if (create_new_page) {
p->present = 0;
p->user = set_user;