From cb88630d86ae4375b1812d41ad072e3efec04dce Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 20 Nov 2022 15:11:53 +0100 Subject: [PATCH] Bugfix: Make alloc_at return the start of the virtual memory range instead of the end --- kernel/src/memory/MemoryManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/src/memory/MemoryManager.cpp b/kernel/src/memory/MemoryManager.cpp index 978a0b98..ebfb7b0e 100644 --- a/kernel/src/memory/MemoryManager.cpp +++ b/kernel/src/memory/MemoryManager.cpp @@ -190,6 +190,8 @@ namespace MemoryManager { CHECK_PAGE_ALIGNED(virt); + u64 start = virt; + while (count--) { u64 frame = TRY(alloc_frame()); @@ -197,7 +199,7 @@ namespace MemoryManager virt += ARCH_PAGE_SIZE; } - return virt; + return start; } Result unmap_owned(u64 virt, usize count)