1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

Kernel: Store a pointer to the owner process in PageDirectory

This replaces the previous owning address space pointer. This commit
should not change any of the existing functionality, but it lays down
the groundwork needed to let us properly access the region table under
the address space spinlock during page fault handling.
This commit is contained in:
Idan Horowitz 2023-04-04 21:06:14 +03:00
parent 65641187ff
commit 003989e1b0
9 changed files with 33 additions and 32 deletions

View file

@ -19,9 +19,9 @@
namespace Kernel::Memory {
ErrorOr<NonnullOwnPtr<AddressSpace>> AddressSpace::try_create(AddressSpace const* parent)
ErrorOr<NonnullOwnPtr<AddressSpace>> AddressSpace::try_create(Process& process, AddressSpace const* parent)
{
auto page_directory = TRY(PageDirectory::try_create_for_userspace());
auto page_directory = TRY(PageDirectory::try_create_for_userspace(process));
VirtualRange total_range = [&]() -> VirtualRange {
if (parent)
@ -33,9 +33,7 @@ ErrorOr<NonnullOwnPtr<AddressSpace>> AddressSpace::try_create(AddressSpace const
return VirtualRange(VirtualAddress { base }, userspace_range_ceiling - base);
}();
auto space = TRY(adopt_nonnull_own_or_enomem(new (nothrow) AddressSpace(move(page_directory), total_range)));
space->page_directory().set_space({}, *space);
return space;
return adopt_nonnull_own_or_enomem(new (nothrow) AddressSpace(move(page_directory), total_range));
}
AddressSpace::AddressSpace(NonnullLockRefPtr<PageDirectory> page_directory, VirtualRange total_range)