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:
parent
ae956edf6e
commit
bf9be3ec01
3 changed files with 23 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue