Add new and delete C++ operators
This commit is contained in:
parent
19dff40ee2
commit
ae9967c462
32
kernel/src/misc/new.cpp
Normal file
32
kernel/src/misc/new.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include "std/stdlib.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user