diff options
-rw-r--r-- | Kernel/Process.cpp | 4 | ||||
-rw-r--r-- | Kernel/VM/Region.h | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index c82ac01357..c72388c962 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -246,8 +246,8 @@ int Process::sys$munmap(void* addr, size_t size) auto make_replacement_region = [&](const Range& new_range) -> Region& { ASSERT(new_range.base() >= old_region_range.base()); ASSERT(new_range.end() <= old_region_range.end()); - size_t new_range_offset_in_old_region = new_range.base().get() - old_region_range.base().get(); - return allocate_split_region(*old_region, new_range, new_range_offset_in_old_region); + size_t new_range_offset_in_vmobject = old_region->offset_in_vmobject() + (new_range.base().get() - old_region_range.base().get()); + return allocate_split_region(*old_region, new_range, new_range_offset_in_vmobject); }; Vector<Region*, 2> new_regions; for (auto& new_range : remaining_ranges_after_unmap) { diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index 16c12d5c13..8ee5600e4d 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -79,6 +79,11 @@ public: return size() / PAGE_SIZE; } + size_t offset_in_vmobject() const + { + return m_offset_in_vmo; + } + int commit(); size_t amount_resident() const; |