diff options
author | Andreas Kling <kling@serenityos.org> | 2022-04-04 23:36:09 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-04-05 01:15:22 +0200 |
commit | e3e1d79a7d92b931892ecbe26761363b41cf6e96 (patch) | |
tree | 23cea90ebafb3493f8ddcd8fa395f9d00cc7589c | |
parent | b36c3a68d8a034d15e4b9164e5d4d4cb82c0cbc7 (diff) | |
download | serenity-e3e1d79a7d92b931892ecbe26761363b41cf6e96.zip |
Kernel: Remove unused ShouldDeallocateVirtualRange parameters
Since there is no separate virtual range allocator anymore, this is
no longer used for anything.
-rw-r--r-- | Kernel/Interrupts/APIC.cpp | 2 | ||||
-rw-r--r-- | Kernel/Memory/AddressSpace.cpp | 14 | ||||
-rw-r--r-- | Kernel/Memory/Region.cpp | 8 | ||||
-rw-r--r-- | Kernel/Memory/Region.h | 8 | ||||
-rw-r--r-- | Kernel/Syscalls/mmap.cpp | 15 | ||||
-rw-r--r-- | Kernel/Syscalls/sigaction.cpp | 12 |
6 files changed, 21 insertions, 38 deletions
diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp index fc1d67a64b..2e52550536 100644 --- a/Kernel/Interrupts/APIC.cpp +++ b/Kernel/Interrupts/APIC.cpp @@ -431,7 +431,7 @@ UNMAP_AFTER_INIT void APIC::do_boot_aps() // NOTE: Since this region is identity-mapped, we have to unmap it manually to prevent the virtual // address range from leaking into the general virtual range allocator. - m_ap_boot_environment->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); + m_ap_boot_environment->unmap(); m_ap_boot_environment = nullptr; // When the APs signal that they finished their initialization they have already switched over to their // idle thread's stack, so the temporary boot stack can be deallocated diff --git a/Kernel/Memory/AddressSpace.cpp b/Kernel/Memory/AddressSpace.cpp index a91bd45f96..50adbb9f29 100644 --- a/Kernel/Memory/AddressSpace.cpp +++ b/Kernel/Memory/AddressSpace.cpp @@ -71,11 +71,9 @@ ErrorOr<void> AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size) return EPERM; // Remove the old region from our regions tree, since were going to add another region - // with the exact same start address, but don't deallocate it yet. + // with the exact same start address. auto region = take_region(*old_region); - - // We manually unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Region::ShouldDeallocateVirtualRange::No); + region->unmap(); auto new_regions = TRY(try_split_region_around_range(*region, range_to_unmap)); @@ -113,11 +111,9 @@ ErrorOr<void> AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size) } // Remove the old region from our regions tree, since were going to add another region - // with the exact same start address, but don't deallocate it yet. + // with the exact same start address. auto region = take_region(*old_region); - - // We manually unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Region::ShouldDeallocateVirtualRange::No); + region->unmap(); // Otherwise, split the regions and collect them for future mapping. auto split_regions = TRY(try_split_region_around_range(*region, range_to_unmap)); @@ -339,7 +335,7 @@ void AddressSpace::remove_all_regions(Badge<Process>) SpinlockLocker pd_locker(m_page_directory->get_lock()); SpinlockLocker mm_locker(s_mm_lock); for (auto& region : m_region_tree.regions()) - region.unmap_with_locks_held(Region::ShouldDeallocateVirtualRange::No, ShouldFlushTLB::No, pd_locker, mm_locker); + region.unmap_with_locks_held(ShouldFlushTLB::No, pd_locker, mm_locker); } m_region_tree.delete_all_regions_assuming_they_are_unmapped(); diff --git a/Kernel/Memory/Region.cpp b/Kernel/Memory/Region.cpp index b59eaa8247..43d58e67b7 100644 --- a/Kernel/Memory/Region.cpp +++ b/Kernel/Memory/Region.cpp @@ -73,7 +73,7 @@ Region::~Region() // If the region is "PROT_NONE", we didn't map it in the first place. } else { SpinlockLocker mm_locker(s_mm_lock); - unmap_with_locks_held(ShouldDeallocateVirtualRange::Yes, ShouldFlushTLB::Yes, pd_locker, mm_locker); + unmap_with_locks_held(ShouldFlushTLB::Yes, pd_locker, mm_locker); VERIFY(!m_page_directory); } } @@ -266,16 +266,16 @@ bool Region::remap_vmobject_page(size_t page_index, bool with_flush) return success; } -void Region::unmap(ShouldDeallocateVirtualRange should_deallocate_range, ShouldFlushTLB should_flush_tlb) +void Region::unmap(ShouldFlushTLB should_flush_tlb) { if (!m_page_directory) return; SpinlockLocker pd_locker(m_page_directory->get_lock()); SpinlockLocker mm_locker(s_mm_lock); - unmap_with_locks_held(should_deallocate_range, should_flush_tlb, pd_locker, mm_locker); + unmap_with_locks_held(should_flush_tlb, pd_locker, mm_locker); } -void Region::unmap_with_locks_held(ShouldDeallocateVirtualRange, ShouldFlushTLB should_flush_tlb, SpinlockLocker<RecursiveSpinlock>&, SpinlockLocker<RecursiveSpinlock>&) +void Region::unmap_with_locks_held(ShouldFlushTLB should_flush_tlb, SpinlockLocker<RecursiveSpinlock>&, SpinlockLocker<RecursiveSpinlock>&) { if (!m_page_directory) return; diff --git a/Kernel/Memory/Region.h b/Kernel/Memory/Region.h index aef490388e..1d70575c6e 100644 --- a/Kernel/Memory/Region.h +++ b/Kernel/Memory/Region.h @@ -182,12 +182,8 @@ public: void set_page_directory(PageDirectory&); ErrorOr<void> map(PageDirectory&, ShouldFlushTLB = ShouldFlushTLB::Yes); - enum class ShouldDeallocateVirtualRange { - No, - Yes, - }; - void unmap(ShouldDeallocateVirtualRange, ShouldFlushTLB = ShouldFlushTLB::Yes); - void unmap_with_locks_held(ShouldDeallocateVirtualRange, ShouldFlushTLB, SpinlockLocker<RecursiveSpinlock>& pd_locker, SpinlockLocker<RecursiveSpinlock>& mm_locker); + void unmap(ShouldFlushTLB = ShouldFlushTLB::Yes); + void unmap_with_locks_held(ShouldFlushTLB, SpinlockLocker<RecursiveSpinlock>& pd_locker, SpinlockLocker<RecursiveSpinlock>& mm_locker); void remap(); diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index 42f199d1ef..8c95eb9a07 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -290,11 +290,9 @@ ErrorOr<FlatPtr> Process::sys$mprotect(Userspace<void*> addr, size_t size, int p TRY(validate_inode_mmap_prot(prot, static_cast<Memory::InodeVMObject const&>(old_region->vmobject()).inode(), old_region->is_shared())); // Remove the old region from our regions tree, since were going to add another region - // with the exact same start address, but do not deallocate it yet + // with the exact same start address. auto region = address_space().take_region(*old_region); - - // Unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); + region->unmap(); // This vector is the region(s) adjacent to our range. // We need to allocate a new region for the range we wanted to change permission bits on. @@ -346,11 +344,9 @@ ErrorOr<FlatPtr> Process::sys$mprotect(Userspace<void*> addr, size_t size, int p continue; } // Remove the old region from our regions tree, since were going to add another region - // with the exact same start address, but dont deallocate it yet + // with the exact same start address. auto region = address_space().take_region(*old_region); - - // Unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); + region->unmap(); // This vector is the region(s) adjacent to our range. // We need to allocate a new region for the range we wanted to change permission bits on. @@ -467,8 +463,7 @@ ErrorOr<FlatPtr> Process::sys$mremap(Userspace<Syscall::SC_mremap_params const*> auto new_vmobject = TRY(Memory::PrivateInodeVMObject::try_create_with_inode(inode)); auto old_name = old_region->take_name(); - // Unmap without deallocating the VM range since we're going to reuse it. - old_region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); + old_region->unmap(); address_space().deallocate_region(*old_region); auto* new_region = TRY(address_space().allocate_region_with_vmobject(range, move(new_vmobject), old_offset, old_name->view(), old_prot, false)); diff --git a/Kernel/Syscalls/sigaction.cpp b/Kernel/Syscalls/sigaction.cpp index 888be45529..38c5cd19ff 100644 --- a/Kernel/Syscalls/sigaction.cpp +++ b/Kernel/Syscalls/sigaction.cpp @@ -156,11 +156,9 @@ ErrorOr<void> Process::remap_range_as_stack(FlatPtr address, size_t size) return EINVAL; // Remove the old region from our regions tree, since were going to add another region - // with the exact same start address, but do not deallocate it yet + // with the exact same start address. auto region = address_space().take_region(*old_region); - - // Unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); + region->unmap(); // This vector is the region(s) adjacent to our range. // We need to allocate a new region for the range we wanted to change permission bits on. @@ -214,11 +212,9 @@ ErrorOr<void> Process::remap_range_as_stack(FlatPtr address, size_t size) continue; } // Remove the old region from our regions tree, since were going to add another region - // with the exact same start address, but dont deallocate it yet + // with the exact same start address. auto region = address_space().take_region(*old_region); - - // Unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); + region->unmap(); // This vector is the region(s) adjacent to our range. // We need to allocate a new region for the range we wanted to change permission bits on. |