Kernel: clamp msync address range instead of calling contains
This commit is contained in:
@@ -99,12 +99,11 @@ namespace Kernel
|
||||
if (m_type != Type::SHARED)
|
||||
return {};
|
||||
|
||||
const vaddr_t first_page = address & PAGE_ADDR_MASK;
|
||||
const vaddr_t last_page = BAN::Math::div_round_up<vaddr_t>(address + size, PAGE_SIZE) * PAGE_SIZE;
|
||||
const vaddr_t first_page = BAN::Math::max(m_vaddr, address) & PAGE_ADDR_MASK;
|
||||
const vaddr_t last_page = BAN::Math::div_round_up(BAN::Math::min(m_vaddr + m_size, address + size), PAGE_SIZE) * PAGE_SIZE;
|
||||
|
||||
RWLockRDGuard _(m_shared_data->rw_lock);
|
||||
for (vaddr_t page_addr = first_page; page_addr < last_page; page_addr += PAGE_SIZE)
|
||||
if (contains(page_addr))
|
||||
m_shared_data->sync_no_lock((m_offset + page_addr - m_vaddr) / PAGE_SIZE);
|
||||
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user