From 910a0d84a048fe6d21da474f7cd2ff58085f1ad6 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 15 Jun 2023 08:21:48 +0200 Subject: [PATCH] vmm: Fix page_sizes values and move declaration to top --- common/mm/vmm.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/common/mm/vmm.c b/common/mm/vmm.c index 4ee192fa..e02efddc 100644 --- a/common/mm/vmm.c +++ b/common/mm/vmm.c @@ -10,7 +10,16 @@ typedef uint64_t pt_entry_t; -static uint64_t page_sizes[5]; +// Maps level indexes to the page size for that level. +_Static_assert(VMM_MAX_LEVEL <= 5, "6-level paging not supported"); +static uint64_t page_sizes[5] = { + 0x1000, + 0x200000, + 0x40000000, + 0x8000000000, + 0x1000000000000, +}; + static pt_entry_t *get_next_level(pagemap_t pagemap, pt_entry_t *current_level, uint64_t virt, enum page_size desired_sz, size_t level_idx, size_t entry); @@ -365,16 +374,6 @@ void map_page(pagemap_t pagemap, uint64_t virt_addr, uint64_t phys_addr, uint64_ #error Unknown architecture #endif -// Maps level indexes to the page size for that level. -_Static_assert(VMM_MAX_LEVEL <= 5, "6-level paging not supported"); -static uint64_t page_sizes[5] = { - 0x1000, - 0x200000, - 0x40000000, - 0x800000000000, - 0x100000000000000, -}; - static pt_entry_t *get_next_level(pagemap_t pagemap, pt_entry_t *current_level, uint64_t virt, enum page_size desired_sz, size_t level_idx, size_t entry) {