From 5294b2a4e549f2ccb45c20bb7f498991102c56c4 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 1 Aug 2024 08:27:30 +0200 Subject: [PATCH] mm/vmm: Fix paging_mode_va_bits() for aarch64 4 level paging and loongarch64 --- common/mm/vmm.h | 2 +- common/protos/limine.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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));