mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 19:38:12 +00:00
Kernel: Rename a very long enum to ShouldDeallocateVirtualRange
ShouldDeallocateVirtualMemoryVirtualRange was a bit on the long side.
This commit is contained in:
parent
cdab5b2091
commit
47bdd7c3a0
5 changed files with 11 additions and 11 deletions
|
@ -379,7 +379,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
|
// 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.
|
// address range from leaking into the general virtual range allocator.
|
||||||
apic_startup_region->unmap(Memory::Region::ShouldDeallocateVirtualMemoryVirtualRange::No);
|
apic_startup_region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT void APIC::boot_aps()
|
UNMAP_AFTER_INIT void APIC::boot_aps()
|
||||||
|
|
|
@ -69,7 +69,7 @@ KResult AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
|
||||||
auto region = take_region(*old_region);
|
auto region = take_region(*old_region);
|
||||||
|
|
||||||
// We manually unmap the old region here, specifying that we *don't* want the VM deallocated.
|
// We manually unmap the old region here, specifying that we *don't* want the VM deallocated.
|
||||||
region->unmap(Region::ShouldDeallocateVirtualMemoryVirtualRange::No);
|
region->unmap(Region::ShouldDeallocateVirtualRange::No);
|
||||||
|
|
||||||
auto new_regions_or_error = try_split_region_around_range(*region, range_to_unmap);
|
auto new_regions_or_error = try_split_region_around_range(*region, range_to_unmap);
|
||||||
if (new_regions_or_error.is_error())
|
if (new_regions_or_error.is_error())
|
||||||
|
@ -115,7 +115,7 @@ KResult AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
|
||||||
auto region = take_region(*old_region);
|
auto region = take_region(*old_region);
|
||||||
|
|
||||||
// We manually unmap the old region here, specifying that we *don't* want the VM deallocated.
|
// We manually unmap the old region here, specifying that we *don't* want the VM deallocated.
|
||||||
region->unmap(Region::ShouldDeallocateVirtualMemoryVirtualRange::No);
|
region->unmap(Region::ShouldDeallocateVirtualRange::No);
|
||||||
|
|
||||||
// Otherwise, split the regions and collect them for future mapping.
|
// Otherwise, split the regions and collect them for future mapping.
|
||||||
auto split_regions_or_error = try_split_region_around_range(*region, range_to_unmap);
|
auto split_regions_or_error = try_split_region_around_range(*region, range_to_unmap);
|
||||||
|
|
|
@ -45,7 +45,7 @@ Region::~Region()
|
||||||
// find the address<->region mappings in an invalid state there.
|
// find the address<->region mappings in an invalid state there.
|
||||||
ScopedSpinLock lock(s_mm_lock);
|
ScopedSpinLock lock(s_mm_lock);
|
||||||
if (m_page_directory) {
|
if (m_page_directory) {
|
||||||
unmap(ShouldDeallocateVirtualMemoryVirtualRange::Yes);
|
unmap(ShouldDeallocateVirtualRange::Yes);
|
||||||
VERIFY(!m_page_directory);
|
VERIFY(!m_page_directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ bool Region::remap_vmobject_page(size_t page_index, bool with_flush)
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region::unmap(ShouldDeallocateVirtualMemoryVirtualRange deallocate_range)
|
void Region::unmap(ShouldDeallocateVirtualRange deallocate_range)
|
||||||
{
|
{
|
||||||
ScopedSpinLock lock(s_mm_lock);
|
ScopedSpinLock lock(s_mm_lock);
|
||||||
if (!m_page_directory)
|
if (!m_page_directory)
|
||||||
|
@ -246,7 +246,7 @@ void Region::unmap(ShouldDeallocateVirtualMemoryVirtualRange deallocate_range)
|
||||||
MM.release_pte(*m_page_directory, vaddr, i == count - 1);
|
MM.release_pte(*m_page_directory, vaddr, i == count - 1);
|
||||||
}
|
}
|
||||||
MM.flush_tlb(m_page_directory, vaddr(), page_count());
|
MM.flush_tlb(m_page_directory, vaddr(), page_count());
|
||||||
if (deallocate_range == ShouldDeallocateVirtualMemoryVirtualRange::Yes) {
|
if (deallocate_range == ShouldDeallocateVirtualRange::Yes) {
|
||||||
m_page_directory->range_allocator().deallocate(range());
|
m_page_directory->range_allocator().deallocate(range());
|
||||||
}
|
}
|
||||||
m_page_directory = nullptr;
|
m_page_directory = nullptr;
|
||||||
|
|
|
@ -168,11 +168,11 @@ public:
|
||||||
|
|
||||||
void set_page_directory(PageDirectory&);
|
void set_page_directory(PageDirectory&);
|
||||||
bool map(PageDirectory&, ShouldFlushTLB = ShouldFlushTLB::Yes);
|
bool map(PageDirectory&, ShouldFlushTLB = ShouldFlushTLB::Yes);
|
||||||
enum class ShouldDeallocateVirtualMemoryVirtualRange {
|
enum class ShouldDeallocateVirtualRange {
|
||||||
No,
|
No,
|
||||||
Yes,
|
Yes,
|
||||||
};
|
};
|
||||||
void unmap(ShouldDeallocateVirtualMemoryVirtualRange = ShouldDeallocateVirtualMemoryVirtualRange::Yes);
|
void unmap(ShouldDeallocateVirtualRange = ShouldDeallocateVirtualRange::Yes);
|
||||||
|
|
||||||
void remap();
|
void remap();
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ KResultOr<FlatPtr> Process::sys$mprotect(Userspace<void*> addr, size_t size, int
|
||||||
auto region = address_space().take_region(*old_region);
|
auto region = address_space().take_region(*old_region);
|
||||||
|
|
||||||
// Unmap the old region here, specifying that we *don't* want the VM deallocated.
|
// Unmap the old region here, specifying that we *don't* want the VM deallocated.
|
||||||
region->unmap(Memory::Region::ShouldDeallocateVirtualMemoryVirtualRange::No);
|
region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No);
|
||||||
|
|
||||||
// This vector is the region(s) adjacent to our range.
|
// 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.
|
// We need to allocate a new region for the range we wanted to change permission bits on.
|
||||||
|
@ -409,7 +409,7 @@ KResultOr<FlatPtr> Process::sys$mprotect(Userspace<void*> addr, size_t size, int
|
||||||
auto region = address_space().take_region(*old_region);
|
auto region = address_space().take_region(*old_region);
|
||||||
|
|
||||||
// Unmap the old region here, specifying that we *don't* want the VM deallocated.
|
// Unmap the old region here, specifying that we *don't* want the VM deallocated.
|
||||||
region->unmap(Memory::Region::ShouldDeallocateVirtualMemoryVirtualRange::No);
|
region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No);
|
||||||
|
|
||||||
// This vector is the region(s) adjacent to our range.
|
// 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.
|
// We need to allocate a new region for the range we wanted to change permission bits on.
|
||||||
|
@ -566,7 +566,7 @@ KResultOr<FlatPtr> Process::sys$mremap(Userspace<const Syscall::SC_mremap_params
|
||||||
auto old_name = old_region->take_name();
|
auto old_name = old_region->take_name();
|
||||||
|
|
||||||
// Unmap without deallocating the VM range since we're going to reuse it.
|
// Unmap without deallocating the VM range since we're going to reuse it.
|
||||||
old_region->unmap(Memory::Region::ShouldDeallocateVirtualMemoryVirtualRange::No);
|
old_region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No);
|
||||||
address_space().deallocate_region(*old_region);
|
address_space().deallocate_region(*old_region);
|
||||||
|
|
||||||
auto new_region_or_error = address_space().allocate_region_with_vmobject(range, new_vmobject.release_nonnull(), old_offset, old_name->view(), old_prot, false);
|
auto new_region_or_error = address_space().allocate_region_with_vmobject(range, new_vmobject.release_nonnull(), old_offset, old_name->view(), old_prot, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue