vmm: Fix page_sizes values and move declaration to top

This commit is contained in:
mintsuki 2023-06-15 08:21:48 +02:00
parent 2da0a08072
commit 910a0d84a0
1 changed files with 10 additions and 11 deletions

View File

@ -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) {