summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-06 23:42:53 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-07 00:39:06 +0200
commitf770b9d430eefe8865e5a555787d8f8d1278a475 (patch)
tree9627bae207e736b7666aae5e40cdfca7ea97b066 /Kernel
parent0ca085910ea5b7540522763d21ddec0358e49620 (diff)
downloadserenity-f770b9d430eefe8865e5a555787d8f8d1278a475.zip
Kernel: Fix bad search-and-replace renames
Oops, I didn't mean to change every *Range* to *VirtualRange*!
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Memory/MemoryManager.cpp34
-rw-r--r--Kernel/Memory/MemoryManager.h24
-rw-r--r--Kernel/Storage/RamdiskController.cpp2
-rw-r--r--Kernel/Syscalls/execve.cpp12
4 files changed, 36 insertions, 36 deletions
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp
index e117aed54c..fd60716e36 100644
--- a/Kernel/Memory/MemoryManager.cpp
+++ b/Kernel/Memory/MemoryManager.cpp
@@ -154,12 +154,12 @@ void MemoryManager::unmap_ksyms_after_init()
UNMAP_AFTER_INIT void MemoryManager::register_reserved_ranges()
{
VERIFY(!m_physical_memory_ranges.is_empty());
- ContiguousReservedMemoryVirtualRange range;
+ ContiguousReservedMemoryRange range;
for (auto& current_range : m_physical_memory_ranges) {
- if (current_range.type != PhysicalMemoryVirtualRangeType::Reserved) {
+ if (current_range.type != PhysicalMemoryRangeType::Reserved) {
if (range.start.is_null())
continue;
- m_reserved_memory_ranges.append(ContiguousReservedMemoryVirtualRange { range.start, current_range.start.get() - range.start.get() });
+ m_reserved_memory_ranges.append(ContiguousReservedMemoryRange { range.start, current_range.start.get() - range.start.get() });
range.start.set((FlatPtr) nullptr);
continue;
}
@@ -168,11 +168,11 @@ UNMAP_AFTER_INIT void MemoryManager::register_reserved_ranges()
}
range.start = current_range.start;
}
- if (m_physical_memory_ranges.last().type != PhysicalMemoryVirtualRangeType::Reserved)
+ if (m_physical_memory_ranges.last().type != PhysicalMemoryRangeType::Reserved)
return;
if (range.start.is_null())
return;
- m_reserved_memory_ranges.append(ContiguousReservedMemoryVirtualRange { range.start, m_physical_memory_ranges.last().start.get() + m_physical_memory_ranges.last().length - range.start.get() });
+ m_reserved_memory_ranges.append(ContiguousReservedMemoryRange { range.start, m_physical_memory_ranges.last().start.get() + m_physical_memory_ranges.last().length - range.start.get() });
}
bool MemoryManager::is_allowed_to_mmap_to_userspace(PhysicalAddress start_address, VirtualRange const& range) const
@@ -194,16 +194,16 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
{
// Register used memory regions that we know of.
m_used_memory_ranges.ensure_capacity(4);
- m_used_memory_ranges.append(UsedMemoryVirtualRange { UsedMemoryVirtualRangeType::LowMemory, PhysicalAddress(0x00000000), PhysicalAddress(1 * MiB) });
- m_used_memory_ranges.append(UsedMemoryVirtualRange { UsedMemoryVirtualRangeType::Prekernel, start_of_prekernel_image, end_of_prekernel_image });
- m_used_memory_ranges.append(UsedMemoryVirtualRange { UsedMemoryVirtualRangeType::Kernel, PhysicalAddress(virtual_to_low_physical((FlatPtr)start_of_kernel_image)), PhysicalAddress(page_round_up(virtual_to_low_physical((FlatPtr)end_of_kernel_image))) });
+ m_used_memory_ranges.append(UsedMemoryRange { UsedMemoryRangeType::LowMemory, PhysicalAddress(0x00000000), PhysicalAddress(1 * MiB) });
+ m_used_memory_ranges.append(UsedMemoryRange { UsedMemoryRangeType::Prekernel, start_of_prekernel_image, end_of_prekernel_image });
+ m_used_memory_ranges.append(UsedMemoryRange { UsedMemoryRangeType::Kernel, PhysicalAddress(virtual_to_low_physical((FlatPtr)start_of_kernel_image)), PhysicalAddress(page_round_up(virtual_to_low_physical((FlatPtr)end_of_kernel_image))) });
if (multiboot_flags & 0x4) {
auto* bootmods_start = multiboot_copy_boot_modules_array;
auto* bootmods_end = bootmods_start + multiboot_copy_boot_modules_count;
for (auto* bootmod = bootmods_start; bootmod < bootmods_end; bootmod++) {
- m_used_memory_ranges.append(UsedMemoryVirtualRange { UsedMemoryVirtualRangeType::BootModule, PhysicalAddress(bootmod->start), PhysicalAddress(bootmod->end) });
+ m_used_memory_ranges.append(UsedMemoryRange { UsedMemoryRangeType::BootModule, PhysicalAddress(bootmod->start), PhysicalAddress(bootmod->end) });
}
}
@@ -224,24 +224,24 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
auto length = mmap->len;
switch (mmap->type) {
case (MULTIBOOT_MEMORY_AVAILABLE):
- m_physical_memory_ranges.append(PhysicalMemoryVirtualRange { PhysicalMemoryVirtualRangeType::Usable, start_address, length });
+ m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::Usable, start_address, length });
break;
case (MULTIBOOT_MEMORY_RESERVED):
- m_physical_memory_ranges.append(PhysicalMemoryVirtualRange { PhysicalMemoryVirtualRangeType::Reserved, start_address, length });
+ m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::Reserved, start_address, length });
break;
case (MULTIBOOT_MEMORY_ACPI_RECLAIMABLE):
- m_physical_memory_ranges.append(PhysicalMemoryVirtualRange { PhysicalMemoryVirtualRangeType::ACPI_Reclaimable, start_address, length });
+ m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::ACPI_Reclaimable, start_address, length });
break;
case (MULTIBOOT_MEMORY_NVS):
- m_physical_memory_ranges.append(PhysicalMemoryVirtualRange { PhysicalMemoryVirtualRangeType::ACPI_NVS, start_address, length });
+ m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::ACPI_NVS, start_address, length });
break;
case (MULTIBOOT_MEMORY_BADRAM):
dmesgln("MM: Warning, detected bad memory range!");
- m_physical_memory_ranges.append(PhysicalMemoryVirtualRange { PhysicalMemoryVirtualRangeType::BadMemory, start_address, length });
+ m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::BadMemory, start_address, length });
break;
default:
dbgln("MM: Unknown range!");
- m_physical_memory_ranges.append(PhysicalMemoryVirtualRange { PhysicalMemoryVirtualRangeType::Unknown, start_address, length });
+ m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::Unknown, start_address, length });
break;
}
@@ -322,7 +322,7 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
m_system_memory_info.user_physical_pages_uncommitted = m_system_memory_info.user_physical_pages;
for (auto& used_range : m_used_memory_ranges) {
- dmesgln("MM: {} range @ {} - {} (size {:#x})", UserMemoryVirtualRangeTypeNames[to_underlying(used_range.type)], used_range.start, used_range.end.offset(-1), used_range.end.as_ptr() - used_range.start.as_ptr());
+ dmesgln("MM: {} range @ {} - {} (size {:#x})", UserMemoryRangeTypeNames[to_underlying(used_range.type)], used_range.start, used_range.end.offset(-1), used_range.end.as_ptr() - used_range.start.as_ptr());
}
dmesgln("MM: Super physical region: {} - {} (size {:#x})", m_super_physical_region->lower(), m_super_physical_region->upper().offset(-1), PAGE_SIZE * m_super_physical_region->size());
@@ -389,7 +389,7 @@ UNMAP_AFTER_INIT void MemoryManager::initialize_physical_pages()
} else {
m_physical_pages_region = found_region->try_take_pages_from_beginning(physical_page_array_pages_and_page_tables_count);
}
- m_used_memory_ranges.append({ UsedMemoryVirtualRangeType::PhysicalPages, m_physical_pages_region->lower(), m_physical_pages_region->upper() });
+ m_used_memory_ranges.append({ UsedMemoryRangeType::PhysicalPages, m_physical_pages_region->lower(), m_physical_pages_region->upper() });
// Create the bare page directory. This is not a fully constructed page directory and merely contains the allocators!
m_kernel_page_directory = PageDirectory::must_create_kernel_page_directory();
diff --git a/Kernel/Memory/MemoryManager.h b/Kernel/Memory/MemoryManager.h
index bc2bbd312b..aaf809acc2 100644
--- a/Kernel/Memory/MemoryManager.h
+++ b/Kernel/Memory/MemoryManager.h
@@ -46,7 +46,7 @@ inline FlatPtr virtual_to_low_physical(FlatPtr virtual_)
return virtual_ - physical_to_virtual_offset;
}
-enum class UsedMemoryVirtualRangeType {
+enum class UsedMemoryRangeType {
LowMemory = 0,
Prekernel,
Kernel,
@@ -54,7 +54,7 @@ enum class UsedMemoryVirtualRangeType {
PhysicalPages,
};
-static constexpr StringView UserMemoryVirtualRangeTypeNames[] {
+static constexpr StringView UserMemoryRangeTypeNames[] {
"Low memory",
"Prekernel",
"Kernel",
@@ -62,18 +62,18 @@ static constexpr StringView UserMemoryVirtualRangeTypeNames[] {
"Physical Pages"
};
-struct UsedMemoryVirtualRange {
- UsedMemoryVirtualRangeType type {};
+struct UsedMemoryRange {
+ UsedMemoryRangeType type {};
PhysicalAddress start;
PhysicalAddress end;
};
-struct ContiguousReservedMemoryVirtualRange {
+struct ContiguousReservedMemoryRange {
PhysicalAddress start;
PhysicalSize length {};
};
-enum class PhysicalMemoryVirtualRangeType {
+enum class PhysicalMemoryRangeType {
Usable = 0,
Reserved,
ACPI_Reclaimable,
@@ -82,8 +82,8 @@ enum class PhysicalMemoryVirtualRangeType {
Unknown,
};
-struct PhysicalMemoryVirtualRange {
- PhysicalMemoryVirtualRangeType type { PhysicalMemoryVirtualRangeType::Unknown };
+struct PhysicalMemoryRange {
+ PhysicalMemoryRangeType type { PhysicalMemoryRangeType::Unknown };
PhysicalAddress start;
PhysicalSize length {};
};
@@ -229,7 +229,7 @@ public:
PageDirectory& kernel_page_directory() { return *m_kernel_page_directory; }
- Vector<UsedMemoryVirtualRange> const& used_memory_ranges() { return m_used_memory_ranges; }
+ Vector<UsedMemoryRange> const& used_memory_ranges() { return m_used_memory_ranges; }
bool is_allowed_to_mmap_to_userspace(PhysicalAddress, VirtualRange const&) const;
PhysicalPageEntry& get_physical_page_entry(PhysicalAddress);
@@ -287,9 +287,9 @@ private:
Region::ListInMemoryManager m_user_regions;
Region::ListInMemoryManager m_kernel_regions;
- Vector<UsedMemoryVirtualRange> m_used_memory_ranges;
- Vector<PhysicalMemoryVirtualRange> m_physical_memory_ranges;
- Vector<ContiguousReservedMemoryVirtualRange> m_reserved_memory_ranges;
+ Vector<UsedMemoryRange> m_used_memory_ranges;
+ Vector<PhysicalMemoryRange> m_physical_memory_ranges;
+ Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;
VMObject::List m_vmobjects;
};
diff --git a/Kernel/Storage/RamdiskController.cpp b/Kernel/Storage/RamdiskController.cpp
index 50fad59ecf..6dc35bae83 100644
--- a/Kernel/Storage/RamdiskController.cpp
+++ b/Kernel/Storage/RamdiskController.cpp
@@ -47,7 +47,7 @@ RamdiskController::RamdiskController()
// Populate ramdisk controllers from Multiboot boot modules, if any.
size_t count = 0;
for (auto& used_memory_range : MM.used_memory_ranges()) {
- if (used_memory_range.type == Memory::UsedMemoryVirtualRangeType::BootModule) {
+ if (used_memory_range.type == Memory::UsedMemoryRangeType::BootModule) {
size_t length = Memory::page_round_up(used_memory_range.end.get()) - used_memory_range.start.get();
auto region = MM.allocate_kernel_region(used_memory_range.start, length, "Ramdisk", Memory::Region::Access::ReadWrite);
if (!region)
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp
index 5ee3589dab..1b5dfb53ca 100644
--- a/Kernel/Syscalls/execve.cpp
+++ b/Kernel/Syscalls/execve.cpp
@@ -154,12 +154,12 @@ static KResultOr<FlatPtr> make_userspace_context_for_main_thread([[maybe_unused]
return new_sp;
}
-struct RequiredLoadVirtualRange {
+struct RequiredLoadRange {
FlatPtr start { 0 };
FlatPtr end { 0 };
};
-static KResultOr<RequiredLoadVirtualRange> get_required_load_range(FileDescription& program_description)
+static KResultOr<RequiredLoadRange> get_required_load_range(FileDescription& program_description)
{
auto& inode = *(program_description.inode());
auto vmobject = Memory::SharedInodeVMObject::try_create_with_inode(inode);
@@ -181,7 +181,7 @@ static KResultOr<RequiredLoadVirtualRange> get_required_load_range(FileDescripti
return EINVAL;
}
- RequiredLoadVirtualRange range {};
+ RequiredLoadRange range {};
elf_image.for_each_program_header([&range](const auto& pheader) {
if (pheader.type() != PT_LOAD)
return;
@@ -221,7 +221,7 @@ static KResultOr<FlatPtr> get_load_offset(const ElfW(Ehdr) & main_program_header
auto main_program_load_range = main_program_load_range_result.value();
- RequiredLoadVirtualRange selected_range {};
+ RequiredLoadRange selected_range {};
if (interpreter_description) {
auto interpreter_load_range_result = get_required_load_range(*interpreter_description);
@@ -235,8 +235,8 @@ static KResultOr<FlatPtr> get_load_offset(const ElfW(Ehdr) & main_program_header
if (main_program_load_range.end < load_range_start || main_program_load_range.start > interpreter_load_range_end)
return random_load_offset_in_range(load_range_start, load_range_size);
- RequiredLoadVirtualRange first_available_part = { load_range_start, main_program_load_range.start };
- RequiredLoadVirtualRange second_available_part = { main_program_load_range.end, interpreter_load_range_end };
+ RequiredLoadRange first_available_part = { load_range_start, main_program_load_range.start };
+ RequiredLoadRange second_available_part = { main_program_load_range.end, interpreter_load_range_end };
// Select larger part
if (first_available_part.end - first_available_part.start > second_available_part.end - second_available_part.start)