diff --git a/common/mm/vmm.h b/common/mm/vmm.h index f3ef4d38..842c034b 100644 --- a/common/mm/vmm.h +++ b/common/mm/vmm.h @@ -58,7 +58,7 @@ void map_page(pagemap_t pagemap, uint64_t virt_addr, uint64_t phys_addr, uint64_ #define PAGING_MODE_MIN PAGING_MODE_AARCH64_4LVL #define PAGING_MODE_MAX PAGING_MODE_AARCH64_5LVL -#define paging_mode_va_bits(mode) ((mode) ? 53 : 48) +#define paging_mode_va_bits(mode) ((mode) ? 53 : 49) static inline uint64_t paging_mode_higher_half(int paging_mode) { if (paging_mode == PAGING_MODE_AARCH64_5LVL) { diff --git a/common/protos/limine.c b/common/protos/limine.c index 82c0519f..bc28fde0 100644 --- a/common/protos/limine.c +++ b/common/protos/limine.c @@ -785,7 +785,7 @@ FEAT_END uint64_t pa = aa64mmfr0 & 0xF; - uint64_t tsz = 64 - paging_mode_va_bits(paging_mode); + uint64_t tsz = 64 - (paging_mode_va_bits(paging_mode) - 1); #endif struct limine_file *kf = ext_mem_alloc(sizeof(struct limine_file));