diff options
author | Marvin Borner | 2021-03-05 18:21:57 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-05 18:21:57 +0100 |
commit | 03e53516ac31639a47584bd7be655cd2f6f44eb9 (patch) | |
tree | b1311abc38467c746747f5facf9c6d56a608ef96 /kernel/features/mm.c | |
parent | 2a9cd43240d33138e127db1ebf10b5e9534b558f (diff) |
Oh man... Idfk anymore
Diffstat (limited to 'kernel/features/mm.c')
-rw-r--r-- | kernel/features/mm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/features/mm.c b/kernel/features/mm.c index ad70685..b17d9fc 100644 --- a/kernel/features/mm.c +++ b/kernel/features/mm.c @@ -128,8 +128,13 @@ u32 virtual_to_physical(struct page_dir *dir, u32 vaddr) u32 pti = PTI(vaddr); union page_dir_entry *dir_entry = &dir->entries[pdi]; + if (!dir_entry->bits.present) + return 0; + struct page_table *table = (struct page_table *)(dir_entry->bits.address * PAGE_SIZE); union page_table_entry *table_entry = &table->entries[pti]; + if (!table_entry->bits.present) + return 0; return (table_entry->bits.address * PAGE_SIZE) + (vaddr & (PAGE_SIZE - 1)); } |