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!
This commit is contained in:
Bananymous 2024-11-17 04:31:46 +02:00
parent 58e45fb394
commit f206e72447
1 changed files with 1 additions and 4 deletions

View File

@ -1682,12 +1682,9 @@ namespace Kernel
if (flags != MS_SYNC && flags != MS_ASYNC && flags != MS_INVALIDATE) if (flags != MS_SYNC && flags != MS_ASYNC && flags != MS_INVALIDATE)
return BAN::Error::from_errno(EINVAL); 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); LockGuard _(m_process_lock);
const vaddr_t vaddr = reinterpret_cast<vaddr_t>(addr);
for (auto& mapped_region : m_mapped_regions) for (auto& mapped_region : m_mapped_regions)
if (mapped_region->overlaps(vaddr, len)) if (mapped_region->overlaps(vaddr, len))
TRY(mapped_region->msync(vaddr, len, flags)); TRY(mapped_region->msync(vaddr, len, flags));