mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 18:17:41 +00:00
Kernel: Remove unused Process pointer in Memory::AddressSpace
Nobody was using the back-pointer to the process, so let's lose it.
This commit is contained in:
parent
2362ebf483
commit
15d033b486
4 changed files with 8 additions and 10 deletions
|
@ -15,21 +15,20 @@
|
||||||
|
|
||||||
namespace Kernel::Memory {
|
namespace Kernel::Memory {
|
||||||
|
|
||||||
OwnPtr<AddressSpace> AddressSpace::try_create(Process& process, AddressSpace const* parent)
|
OwnPtr<AddressSpace> AddressSpace::try_create(AddressSpace const* parent)
|
||||||
{
|
{
|
||||||
auto page_directory = PageDirectory::try_create_for_userspace(parent ? &parent->page_directory().range_allocator() : nullptr);
|
auto page_directory = PageDirectory::try_create_for_userspace(parent ? &parent->page_directory().range_allocator() : nullptr);
|
||||||
if (!page_directory)
|
if (!page_directory)
|
||||||
return {};
|
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)
|
if (!space)
|
||||||
return {};
|
return {};
|
||||||
space->page_directory().set_space({}, *space);
|
space->page_directory().set_space({}, *space);
|
||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddressSpace::AddressSpace(Process& process, NonnullRefPtr<PageDirectory> page_directory)
|
AddressSpace::AddressSpace(NonnullRefPtr<PageDirectory> page_directory)
|
||||||
: m_process(&process)
|
: m_page_directory(move(page_directory))
|
||||||
, m_page_directory(move(page_directory))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Kernel::Memory {
|
||||||
|
|
||||||
class AddressSpace {
|
class AddressSpace {
|
||||||
public:
|
public:
|
||||||
static OwnPtr<AddressSpace> try_create(Process&, AddressSpace const* parent);
|
static OwnPtr<AddressSpace> try_create(AddressSpace const* parent);
|
||||||
~AddressSpace();
|
~AddressSpace();
|
||||||
|
|
||||||
PageDirectory& page_directory() { return *m_page_directory; }
|
PageDirectory& page_directory() { return *m_page_directory; }
|
||||||
|
@ -66,9 +66,8 @@ public:
|
||||||
size_t amount_purgeable_nonvolatile() const;
|
size_t amount_purgeable_nonvolatile() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AddressSpace(Process&, NonnullRefPtr<PageDirectory>);
|
explicit AddressSpace(NonnullRefPtr<PageDirectory>);
|
||||||
|
|
||||||
Process* m_process { nullptr };
|
|
||||||
mutable RecursiveSpinLock m_lock;
|
mutable RecursiveSpinLock m_lock;
|
||||||
|
|
||||||
RefPtr<PageDirectory> m_page_directory;
|
RefPtr<PageDirectory> m_page_directory;
|
||||||
|
|
|
@ -275,7 +275,7 @@ Process::Process(const String& name, uid_t uid, gid_t gid, ProcessID ppid, bool
|
||||||
|
|
||||||
KResult Process::attach_resources(RefPtr<Thread>& first_thread, Process* fork_parent)
|
KResult Process::attach_resources(RefPtr<Thread>& 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)
|
if (!m_space)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -453,7 +453,7 @@ static KResultOr<LoadResult> load_elf_object(NonnullOwnPtr<Memory::AddressSpace>
|
||||||
KResultOr<LoadResult> Process::load(NonnullRefPtr<FileDescription> main_program_description,
|
KResultOr<LoadResult> Process::load(NonnullRefPtr<FileDescription> main_program_description,
|
||||||
RefPtr<FileDescription> interpreter_description, const ElfW(Ehdr) & main_program_header)
|
RefPtr<FileDescription> 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)
|
if (!new_space)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue