1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

Kernel: More gracefully handle out-of-memory when creating PageDirectory

This commit is contained in:
Tom 2020-09-27 08:10:10 -06:00 committed by Andreas Kling
parent ae956edf6e
commit bf9be3ec01
3 changed files with 23 additions and 5 deletions

View file

@ -40,9 +40,12 @@ class PageDirectory : public RefCounted<PageDirectory> {
friend class MemoryManager;
public:
static NonnullRefPtr<PageDirectory> create_for_userspace(Process& process, const RangeAllocator* parent_range_allocator = nullptr)
static RefPtr<PageDirectory> create_for_userspace(Process& process, const RangeAllocator* parent_range_allocator = nullptr)
{
return adopt(*new PageDirectory(process, parent_range_allocator));
auto page_directory = adopt(*new PageDirectory(process, parent_range_allocator));
if (!page_directory->process())
return {};
return page_directory;
}
static NonnullRefPtr<PageDirectory> create_kernel_page_directory() { return adopt(*new PageDirectory); }
static RefPtr<PageDirectory> find_by_cr3(u32);