MemoryManager: Add an unmap_weak_and_free_vm() helper function

This function mirrors unmap_owned_and_free_vm(), but using weak unmapping (does not free the underlying physical memory)
This commit is contained in:
apio 2023-01-05 21:50:06 +01:00
parent d3c414af4e
commit c53bba0392
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 10 additions and 0 deletions

View File

@ -309,6 +309,15 @@ namespace MemoryManager
return {};
}
Result<void> unmap_weak_and_free_vm(u64 virt, usize count)
{
CHECK_PAGE_ALIGNED(virt);
KernelVM::free_several_pages(virt, count);
return unmap_weak(virt, count);
}
Result<void> remap_unaligned(u64 address, usize count, int flags)
{
if (!is_aligned<ARCH_PAGE_SIZE>(address)) count++;

View File

@ -30,6 +30,7 @@ namespace MemoryManager
Result<void> unmap_owned(u64 virt, usize count);
Result<void> unmap_owned_and_free_vm(u64 virt, usize count);
Result<void> unmap_weak(u64 virt, usize count);
Result<void> unmap_weak_and_free_vm(u64 virt, usize count);
usize free();
usize used();