From a218423b9c5f3ff83c5e609fc6acfb9c7c9e04b8 Mon Sep 17 00:00:00 2001 From: Andy-Python-Programmer Date: Thu, 27 Jan 2022 10:59:16 +1100 Subject: [PATCH] map_page: add support for mapping 1GiB pages Signed-off-by: Andy-Python-Programmer --- stage23/mm/vmm.c | 6 ++++++ stage23/mm/vmm.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) 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);