improved runtime error handling

This commit is contained in:
Bernd Herzog 2023-03-18 22:41:26 +01:00
parent ed1c2e1c03
commit b83f43793c
6 changed files with 75 additions and 28 deletions

View file

@ -26,11 +26,17 @@
#include <ch.h>
void* operator new(size_t size) {
return chHeapAlloc(0x0, size);
void *p = chHeapAlloc(0x0, size);
if (p == nullptr)
chDbgPanic("Out of Memory");
return p;
}
void* operator new[](size_t size) {
return chHeapAlloc(0x0, size);
void *p = chHeapAlloc(0x0, size);
if (p == nullptr)
chDbgPanic("Out of Memory");
return p;
}
void operator delete(void* p) noexcept {