map_page: add support for mapping 1GiB pages
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
diff --git a/stage23/mm/vmm.c b/stage23/mm/vmm.c
index 2f1ab069..d16233c8 100644
--- a/stage23/mm/vmm.c
+++ b/stage23/mm/vmm.c
@@ -65,6 +65,12 @@ level5:
pml4 = get_next_level(pml5, pml5_entry);
level4:
pml3 = get_next_level(pml4, pml4_entry);
+
+ if (pg_size == Size1GiB) {
+ pml3[pml3_entry] = (pt_entry_t)(phys_addr | flags | (1 << 7));
+ return;
+ }
+
pml2 = get_next_level(pml3, pml3_entry);
if (pg_size == Size2MiB) {
diff --git a/stage23/mm/vmm.h b/stage23/mm/vmm.h
index cea85baf..12e70e75 100644
--- a/stage23/mm/vmm.h
+++ b/stage23/mm/vmm.h
@@ -15,7 +15,8 @@ typedef struct {
enum page_size {
Size4KiB,
- Size2MiB
+ Size2MiB,
+ Size1GiB
};
void vmm_assert_nx(void);
