Use VMAHandle.Contains()

Why do extra math when we have a function specifically for this?
This commit is contained in:
Stephen Miller 2025-05-09 20:55:47 -05:00
parent 5a455c97de
commit 21e8fb2e20

View File

@ -302,7 +302,7 @@ int MemoryManager::PoolCommit(VAddr virtual_addr, size_t size, MemoryProt prot)
VAddr mapped_addr = Common::AlignUp(virtual_addr, alignment); VAddr mapped_addr = Common::AlignUp(virtual_addr, alignment);
auto& vma = FindVMA(mapped_addr)->second; auto& vma = FindVMA(mapped_addr)->second;
if (vma.type != VMAType::PoolReserved || vma.base + vma.size < virtual_addr + size) { if (vma.type != VMAType::PoolReserved || !vma.Contains(mapped_addr, size)) {
// If the VMA isn't PoolReserved or if there's not enough space to commit, return EINVAL // If the VMA isn't PoolReserved or if there's not enough space to commit, return EINVAL
LOG_ERROR(Kernel_Vmm, LOG_ERROR(Kernel_Vmm,
"Pooled region {:#x} to {:#x} is not large enough to commit from {:#x} to {:#x}", "Pooled region {:#x} to {:#x} is not large enough to commit from {:#x} to {:#x}",