summaryrefslogtreecommitdiff
path: root/Kernel/VM
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2021-06-28 18:58:23 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-28 19:26:06 +0200
commit10728cd4213e4077f4b8352e912849dd725fe47d (patch)
treecf55bdd53103374b6215e628c6b1744f74239ad0 /Kernel/VM
parent65566d68683ecbfc2a10b4fb544d5e6f362ae230 (diff)
downloadserenity-10728cd4213e4077f4b8352e912849dd725fe47d.zip
Kernel: Fix page round wrap detection for 64-bit
We were assuming 32-bit pointers, which will not always be the case Also fixed an incorrect comment about wrapping
Diffstat (limited to 'Kernel/VM')
-rw-r--r--Kernel/VM/MemoryManager.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h
index 95ad451d2c..f2ee0acd45 100644
--- a/Kernel/VM/MemoryManager.h
+++ b/Kernel/VM/MemoryManager.h
@@ -22,13 +22,13 @@ namespace Kernel {
constexpr bool page_round_up_would_wrap(FlatPtr x)
{
- return x > 0xfffff000u;
+ return x > (explode_byte(0xFF) & ~0xFFF);
}
constexpr FlatPtr page_round_up(FlatPtr x)
{
FlatPtr rounded = (((FlatPtr)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1));
- // Rounding up >0xffff0000 wraps back to 0. That's never what we want.
+ // Rounding up >0xfffff000 wraps back to 0. That's never what we want.
VERIFY(x == 0 || rounded != 0);
return rounded;
}