atrocities against memory
This commit is contained in:
@@ -37,7 +37,7 @@ void Thread::kickoffUsermode (Thread *object){
|
||||
|
||||
Thread::Thread (bool kernel, void * start): queue_link(nullptr), isKernel(kernel), start(start), id(idCounter++), kill_flag(false){
|
||||
StackPointer.isr = reinterpret_cast<void *>(reserved_stack_space_isr + STACK_SIZE);
|
||||
StackPointer.user = reinterpret_cast<void *>(reserved_stack_space_user + STACK_SIZE);
|
||||
StackPointer.user = reinterpret_cast<void *>(PageFrameAllocator::alloc(false) + STACK_SIZE);
|
||||
prepareContext(StackPointer.isr, context, kickoff, reinterpret_cast<uintptr_t>(this), 0, 0);
|
||||
}
|
||||
|
||||
@@ -52,14 +52,13 @@ void Thread::resume(Thread *next) {
|
||||
context_switch(&next->context, &context);
|
||||
}
|
||||
|
||||
void* operator new(std::size_t sz)
|
||||
void* operator new(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 *ptr = PageFrameAllocator::alloc(true);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user