From eb8a3c0e09d71dd485be77a039669aabfac63848 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Sat, 6 Feb 2021 00:06:29 -0800 Subject: [PATCH] [kernel] Fix frame allocator next-block bug The frame allocator was causing page faults when exhausting the first (well, last, because it starts from the end) block of free pages. Turns out it was just incrementing instead of decrementing and thus running off the end. --- src/kernel/frame_allocator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/frame_allocator.cpp b/src/kernel/frame_allocator.cpp index 349ba85..c68b957 100644 --- a/src/kernel/frame_allocator.cpp +++ b/src/kernel/frame_allocator.cpp @@ -32,7 +32,7 @@ bsf(uint64_t v) size_t frame_allocator::allocate(size_t count, uintptr_t *address) { - for (long i = m_count - 1; i >= 0; ++i) { + for (long i = m_count - 1; i >= 0; --i) { frame_block &block = m_blocks[i]; if (!block.map1)