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

Kernel: Don't use naked new statements in init process

Instead, try to create the device objects in separate static methods,
and if we fail for some odd reason to allocate memory for such devices,
just panic with that reason.
This commit is contained in:
Liav A 2021-06-18 11:37:26 +03:00 committed by Andreas Kling
parent fba3c77a04
commit 29f9a38f76
11 changed files with 74 additions and 18 deletions

View file

@ -8,11 +8,17 @@
#include <AK/Memory.h>
#include <AK/StdLibExtras.h>
#include <Kernel/Arch/PC/BIOS.h>
#include <Kernel/Panic.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/TypedMapping.h>
namespace Kernel {
UNMAP_AFTER_INIT NonnullRefPtr<MemoryDevice> MemoryDevice::must_create()
{
return adopt_ref_if_nonnull(new MemoryDevice).release_nonnull();
}
UNMAP_AFTER_INIT MemoryDevice::MemoryDevice()
: CharacterDevice(1, 1)
{