summaryrefslogtreecommitdiffhomepage
path: root/SDK/Library/CoreCxxRuntime
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-09 00:42:44 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-09 00:42:44 +0200
commitaf8a516fc22865abd80d6e26f1541fa3d6bebfdc (patch)
tree96d42a10945fc03df022389aef54708383c1d616 /SDK/Library/CoreCxxRuntime
parenta874e9cc98df994178d55996943fe81799c61d2f (diff)
MHR-23: :boom:, refactors.
- Move NewBoot to /Boot, thus making Kernel directory only containing the kernel. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'SDK/Library/CoreCxxRuntime')
-rw-r--r--SDK/Library/CoreCxxRuntime/.gitkeep0
-rw-r--r--SDK/Library/CoreCxxRuntime/Sources/New+Delete.cxx33
2 files changed, 33 insertions, 0 deletions
diff --git a/SDK/Library/CoreCxxRuntime/.gitkeep b/SDK/Library/CoreCxxRuntime/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/SDK/Library/CoreCxxRuntime/.gitkeep
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 <Headers/Heap.h>
+
+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