From ae9967c4622e3f168defd3fec6d431c09b1456ee Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 25 Sep 2022 18:12:03 +0200 Subject: [PATCH] Add new and delete C++ operators --- kernel/src/misc/new.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 kernel/src/misc/new.cpp diff --git a/kernel/src/misc/new.cpp b/kernel/src/misc/new.cpp new file mode 100644 index 00000000..8ecd8175 --- /dev/null +++ b/kernel/src/misc/new.cpp @@ -0,0 +1,32 @@ +#include "std/stdlib.h" +#include + +void* operator new(size_t size) +{ + return kmalloc(size); +} + +void* operator new[](size_t size) +{ + return kmalloc(size); +} + +void operator delete(void* p) +{ + kfree(p); +} + +void operator delete[](void* p) +{ + kfree(p); +} + +void operator delete(void* p, size_t) +{ + kfree(p); +} + +void operator delete[](void* p, size_t) +{ + kfree(p); +} \ No newline at end of file