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 aa926e7a6b
commit 3b9d29385c
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);
@ -232,16 +241,6 @@ level4:
#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) {