diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-23 11:32:25 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-23 11:33:36 +0100 |
commit | 58fb3ebf660e87a7ac93b5e8a7433ff441e30639 (patch) | |
tree | 1c899f032c0f07a3a8a74649204b2fd06f0775a5 /Userland/DevTools | |
parent | c1c9da6c35ff3f28aefb6370dad898cb85e6bcef (diff) | |
download | serenity-58fb3ebf660e87a7ac93b5e8a7433ff441e30639.zip |
LibCore+AK: Move MappedFile from AK to LibCore
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp | 4 | ||||
-rw-r--r-- | Userland/DevTools/Profiler/DisassemblyModel.cpp | 4 | ||||
-rw-r--r-- | Userland/DevTools/Profiler/Process.cpp | 2 | ||||
-rw-r--r-- | Userland/DevTools/Profiler/Process.h | 4 | ||||
-rw-r--r-- | Userland/DevTools/Profiler/Profile.cpp | 4 | ||||
-rw-r--r-- | Userland/DevTools/Profiler/Profile.h | 2 | ||||
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.cpp | 8 | ||||
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.h | 4 |
8 files changed, 16 insertions, 16 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp index fdc43da679..e98c7f5d71 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp @@ -5,8 +5,8 @@ */ #include "DisassemblyModel.h" -#include <AK/MappedFile.h> #include <AK/StringBuilder.h> +#include <LibCore/MappedFile.h> #include <LibDebug/DebugSession.h> #include <LibELF/Image.h> #include <LibSymbolication/Symbolication.h> @@ -33,7 +33,7 @@ DisassemblyModel::DisassemblyModel(const Debug::DebugSession& debug_session, con auto maybe_kernel_base = Symbolication::kernel_base(); if (maybe_kernel_base.has_value() && containing_function.value().address_low >= maybe_kernel_base.value()) { - auto file_or_error = MappedFile::map("/boot/Kernel.debug"); + auto file_or_error = Core::MappedFile::map("/boot/Kernel.debug"); if (file_or_error.is_error()) return; kernel_elf = make<ELF::Image>(file_or_error.value()->bytes()); diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp index 749377b38c..9cb250262b 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.cpp +++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp @@ -6,7 +6,7 @@ #include "DisassemblyModel.h" #include "Profile.h" -#include <AK/MappedFile.h> +#include <LibCore/MappedFile.h> #include <LibDebug/DebugInfo.h> #include <LibELF/Image.h> #include <LibGUI/Painter.h> @@ -40,7 +40,7 @@ static ELF::Image* try_load_kernel_binary() { if (s_kernel_binary.has_value()) return &s_kernel_binary->elf; - auto kernel_binary_or_error = MappedFile::map("/boot/Kernel"); + auto kernel_binary_or_error = Core::MappedFile::map("/boot/Kernel"); if (!kernel_binary_or_error.is_error()) { auto kernel_binary = kernel_binary_or_error.release_value(); s_kernel_binary = { { kernel_binary, ELF::Image(kernel_binary->bytes()) } }; diff --git a/Userland/DevTools/Profiler/Process.cpp b/Userland/DevTools/Profiler/Process.cpp index 0924ab8959..1d46c6323e 100644 --- a/Userland/DevTools/Profiler/Process.cpp +++ b/Userland/DevTools/Profiler/Process.cpp @@ -48,7 +48,7 @@ static MappedObject* get_or_create_mapped_object(const String& path) if (auto it = g_mapped_object_cache.find(path); it != g_mapped_object_cache.end()) return it->value.ptr(); - auto file_or_error = MappedFile::map(path); + auto file_or_error = Core::MappedFile::map(path); if (file_or_error.is_error()) { g_mapped_object_cache.set(path, {}); return nullptr; diff --git a/Userland/DevTools/Profiler/Process.h b/Userland/DevTools/Profiler/Process.h index 322a5ff098..d63d2a7c61 100644 --- a/Userland/DevTools/Profiler/Process.h +++ b/Userland/DevTools/Profiler/Process.h @@ -8,16 +8,16 @@ #include "EventSerialNumber.h" #include <AK/HashMap.h> -#include <AK/MappedFile.h> #include <AK/OwnPtr.h> #include <AK/Vector.h> +#include <LibCore/MappedFile.h> #include <LibDebug/DebugInfo.h> #include <LibELF/Image.h> namespace Profiler { struct MappedObject { - NonnullRefPtr<MappedFile> file; + NonnullRefPtr<Core::MappedFile> file; ELF::Image elf; }; diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index 5166773352..54c6c33fdb 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -10,12 +10,12 @@ #include "SamplesModel.h" #include <AK/HashTable.h> #include <AK/LexicalPath.h> -#include <AK/MappedFile.h> #include <AK/NonnullOwnPtrVector.h> #include <AK/QuickSort.h> #include <AK/RefPtr.h> #include <AK/Try.h> #include <LibCore/File.h> +#include <LibCore/MappedFile.h> #include <LibELF/Image.h> #include <LibSymbolication/Symbolication.h> #include <sys/stat.h> @@ -226,7 +226,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path auto& object = json.value().as_object(); if (!g_kernel_debuginfo_object.has_value()) { - auto debuginfo_file_or_error = MappedFile::map("/boot/Kernel.debug"); + auto debuginfo_file_or_error = Core::MappedFile::map("/boot/Kernel.debug"); if (!debuginfo_file_or_error.is_error()) { auto debuginfo_file = debuginfo_file_or_error.release_value(); auto debuginfo_image = ELF::Image(debuginfo_file->bytes()); diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index 377a3a65af..1e6ac39a36 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -17,10 +17,10 @@ #include <AK/JsonArray.h> #include <AK/JsonObject.h> #include <AK/JsonValue.h> -#include <AK/MappedFile.h> #include <AK/NonnullRefPtrVector.h> #include <AK/OwnPtr.h> #include <AK/Variant.h> +#include <LibCore/MappedFile.h> #include <LibELF/Image.h> #include <LibGUI/Forward.h> #include <LibGUI/ModelIndex.h> diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 0b9e4b2fcf..0ea461c761 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -13,9 +13,9 @@ #include <AK/FileStream.h> #include <AK/Format.h> #include <AK/LexicalPath.h> -#include <AK/MappedFile.h> #include <AK/StringUtils.h> #include <LibCore/File.h> +#include <LibCore/MappedFile.h> #include <LibELF/AuxiliaryVector.h> #include <LibELF/Image.h> #include <LibELF/Validation.h> @@ -149,7 +149,7 @@ void Emulator::setup_stack(Vector<ELF::AuxiliaryValue> aux_vector) bool Emulator::load_elf() { - auto file_or_error = MappedFile::map(m_executable_path); + auto file_or_error = Core::MappedFile::map(m_executable_path); if (file_or_error.is_error()) { reportln("Unable to map {}: {}", m_executable_path, file_or_error.error()); return false; @@ -172,7 +172,7 @@ bool Emulator::load_elf() VERIFY(!interpreter_path.is_null()); dbgln("interpreter: {}", interpreter_path); - auto interpreter_file_or_error = MappedFile::map(interpreter_path); + auto interpreter_file_or_error = Core::MappedFile::map(interpreter_path); VERIFY(!interpreter_file_or_error.is_error()); auto interpreter_image_data = interpreter_file_or_error.value()->bytes(); ELF::Image interpreter_image(interpreter_image_data); @@ -400,7 +400,7 @@ MmapRegion const* Emulator::load_library_from_address(FlatPtr address) lib_path = String::formatted("/usr/lib/{}", lib_path); if (!m_dynamic_library_cache.contains(lib_path)) { - auto file_or_error = MappedFile::map(lib_path); + auto file_or_error = Core::MappedFile::map(lib_path); if (file_or_error.is_error()) return {}; diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.h b/Userland/DevTools/UserspaceEmulator/Emulator.h index 0a71c286f6..ff54269edf 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.h +++ b/Userland/DevTools/UserspaceEmulator/Emulator.h @@ -13,8 +13,8 @@ #include "SoftCPU.h" #include "SoftMMU.h" #include <AK/FileStream.h> -#include <AK/MappedFile.h> #include <AK/Types.h> +#include <LibCore/MappedFile.h> #include <LibDebug/DebugInfo.h> #include <LibELF/AuxiliaryVector.h> #include <LibELF/Image.h> @@ -273,7 +273,7 @@ private: Optional<size_t> m_loader_text_size; struct CachedELF { - NonnullRefPtr<MappedFile> mapped_file; + NonnullRefPtr<Core::MappedFile> mapped_file; NonnullOwnPtr<Debug::DebugInfo> debug_info; NonnullOwnPtr<ELF::Image> image; }; |