diff --git a/Kernel/Memory/AddressSpace.cpp b/Kernel/Memory/AddressSpace.cpp index cc93760dcb..653160479f 100644 --- a/Kernel/Memory/AddressSpace.cpp +++ b/Kernel/Memory/AddressSpace.cpp @@ -15,21 +15,20 @@ namespace Kernel::Memory { -OwnPtr AddressSpace::try_create(Process& process, AddressSpace const* parent) +OwnPtr AddressSpace::try_create(AddressSpace const* parent) { auto page_directory = PageDirectory::try_create_for_userspace(parent ? &parent->page_directory().range_allocator() : nullptr); if (!page_directory) return {}; - auto space = adopt_own_if_nonnull(new (nothrow) AddressSpace(process, page_directory.release_nonnull())); + auto space = adopt_own_if_nonnull(new (nothrow) AddressSpace(page_directory.release_nonnull())); if (!space) return {}; space->page_directory().set_space({}, *space); return space; } -AddressSpace::AddressSpace(Process& process, NonnullRefPtr page_directory) - : m_process(&process) - , m_page_directory(move(page_directory)) +AddressSpace::AddressSpace(NonnullRefPtr page_directory) + : m_page_directory(move(page_directory)) { } diff --git a/Kernel/Memory/AddressSpace.h b/Kernel/Memory/AddressSpace.h index 973a7f4fe3..e7705e266d 100644 --- a/Kernel/Memory/AddressSpace.h +++ b/Kernel/Memory/AddressSpace.h @@ -18,7 +18,7 @@ namespace Kernel::Memory { class AddressSpace { public: - static OwnPtr try_create(Process&, AddressSpace const* parent); + static OwnPtr try_create(AddressSpace const* parent); ~AddressSpace(); PageDirectory& page_directory() { return *m_page_directory; } @@ -66,9 +66,8 @@ public: size_t amount_purgeable_nonvolatile() const; private: - AddressSpace(Process&, NonnullRefPtr); + explicit AddressSpace(NonnullRefPtr); - Process* m_process { nullptr }; mutable RecursiveSpinLock m_lock; RefPtr m_page_directory; diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 55cce1afd0..06c9d3475b 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -275,7 +275,7 @@ Process::Process(const String& name, uid_t uid, gid_t gid, ProcessID ppid, bool KResult Process::attach_resources(RefPtr& first_thread, Process* fork_parent) { - m_space = Memory::AddressSpace::try_create(*this, fork_parent ? &fork_parent->address_space() : nullptr); + m_space = Memory::AddressSpace::try_create(fork_parent ? &fork_parent->address_space() : nullptr); if (!m_space) return ENOMEM; diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 1b5dfb53ca..437320f726 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -453,7 +453,7 @@ static KResultOr load_elf_object(NonnullOwnPtr KResultOr Process::load(NonnullRefPtr main_program_description, RefPtr interpreter_description, const ElfW(Ehdr) & main_program_header) { - auto new_space = Memory::AddressSpace::try_create(*this, nullptr); + auto new_space = Memory::AddressSpace::try_create(nullptr); if (!new_space) return ENOMEM;