From af8a516fc22865abd80d6e26f1541fa3d6bebfdc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 9 May 2024 00:42:44 +0200 Subject: MHR-23: :boom:, refactors. - Move NewBoot to /Boot, thus making Kernel directory only containing the kernel. Signed-off-by: Amlal El Mahrouss --- SDK/Library/CoreCxxRuntime/.gitkeep | 0 SDK/Library/CoreCxxRuntime/Sources/New+Delete.cxx | 33 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 SDK/Library/CoreCxxRuntime/.gitkeep create mode 100644 SDK/Library/CoreCxxRuntime/Sources/New+Delete.cxx (limited to 'SDK/Library/CoreCxxRuntime') diff --git a/SDK/Library/CoreCxxRuntime/.gitkeep b/SDK/Library/CoreCxxRuntime/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/SDK/Library/CoreCxxRuntime/Sources/New+Delete.cxx b/SDK/Library/CoreCxxRuntime/Sources/New+Delete.cxx new file mode 100644 index 00000000..6ed8fecf --- /dev/null +++ b/SDK/Library/CoreCxxRuntime/Sources/New+Delete.cxx @@ -0,0 +1,33 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +#include + +typedef SizeType size_t; + +void* operator new[](size_t sz) +{ + if (sz == 0) + ++sz; + + return RtTlsAllocate(sz, kStandardAllocation); +} + +void* operator new(size_t sz) +{ + if (sz == 0) + ++sz; + + return RtTlsAllocate(sz, kArrayAllocation); +} + +void operator delete[](void* ptr) +{ + if (ptr == nullptr) + return; + + RtTlsFree(ptr); +} \ No newline at end of file -- cgit v1.2.3