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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "../types.h"
|
||||
|
||||
/// Stack size for each thread
|
||||
constexpr uint32_t STACK_SIZE = 4096;
|
||||
constexpr uint32_t STACK_SIZE = 3096;
|
||||
|
||||
/*! \brief The Thread is an object used by the scheduler.
|
||||
* \ingroup thread
|
||||
@@ -35,7 +35,7 @@ class Thread {
|
||||
friend class Semaphore;
|
||||
/*! \brief Memory reserved for this threads stack
|
||||
*/
|
||||
alignas(16) char reserved_stack_space_user[STACK_SIZE];
|
||||
// alignas(16) char reserved_stack_space_user[STACK_SIZE];
|
||||
alignas(16) char reserved_stack_space_isr[STACK_SIZE];
|
||||
|
||||
protected:
|
||||
@@ -118,5 +118,5 @@ class Thread {
|
||||
//
|
||||
|
||||
|
||||
void* operator new ( std::size_t count );
|
||||
void* operator new ( size_t count );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user