added new override

This commit is contained in:
user
2026-02-03 19:48:53 +01:00
parent 8cab43f197
commit 467fc6cd0c
2 changed files with 21 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
#include "thread.h"
#include "../arch/core_ring.h"
#include "../memory/pageframealloc.h"
#include "../debug/kernelpanic.h"
#include "../interrupt/guard.h"
#include "debug/output.h"
@@ -52,6 +52,17 @@ void Thread::resume(Thread *next) {
context_switch(&next->context, &context);
}
void* operator new(std::size_t sz)
{
if (sz == 0)
++sz; // avoid std::malloc(0) which may return nullptr on success
if (void *ptr = PagreFrameAllocator::alloc(true))
return ptr;
}
void Thread::go() { context_launch(&context); }
void Thread::action() { kernelpanic("Wrong entry / missing action in Thread"); }