From f206e72447335721328b322a7c67701092b51fa2 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 17 Nov 2024 04:31:46 +0200 Subject: [PATCH] Kernel: Don't require msync addresses to be page aligned Inodes implementing msync can require page aligned addresses, but are also allowed to not :) This reduces sizes of framebuffer msyncs! --- kernel/kernel/Process.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index 7a917f03..089b4a0e 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -1682,12 +1682,9 @@ namespace Kernel if (flags != MS_SYNC && flags != MS_ASYNC && flags != MS_INVALIDATE) return BAN::Error::from_errno(EINVAL); - vaddr_t vaddr = (vaddr_t)addr; - if (vaddr % PAGE_SIZE != 0) - return BAN::Error::from_errno(EINVAL); - LockGuard _(m_process_lock); + const vaddr_t vaddr = reinterpret_cast(addr); for (auto& mapped_region : m_mapped_regions) if (mapped_region->overlaps(vaddr, len)) TRY(mapped_region->msync(vaddr, len, flags));