Store the stack inside a thread
This commit is contained in:
parent
00cf267ac7
commit
1b92fe36b4
@ -29,6 +29,8 @@ namespace Scheduler
|
||||
Stack idle_stack{idle_stack_vm, ARCH_PAGE_SIZE};
|
||||
g_idle.set_sp(idle_stack.top());
|
||||
|
||||
g_idle.stack = idle_stack;
|
||||
|
||||
kinfoln("CREATED IDLE THREAD: id %lu with ip %lx and sp %lx", g_idle.id, g_idle.ip(), g_idle.sp());
|
||||
|
||||
g_current = &g_idle;
|
||||
@ -56,6 +58,8 @@ namespace Scheduler
|
||||
Stack thread_stack{thread_stack_vm, ARCH_PAGE_SIZE * 4};
|
||||
thread->set_sp(thread_stack.top());
|
||||
|
||||
thread->stack = thread_stack;
|
||||
|
||||
g_threads.append(thread);
|
||||
|
||||
kinfoln("CREATED THREAD: id %lu with ip %lx and sp %lx", thread->id, thread->ip(), thread->sp());
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <luna/LinkedList.h>
|
||||
#include <luna/Result.h>
|
||||
#include <luna/Stack.h>
|
||||
|
||||
#ifdef ARCH_X86_64
|
||||
#include "arch/x86_64/CPU.h"
|
||||
@ -29,6 +30,8 @@ struct Thread : public DoublyLinkedListNode<Thread>
|
||||
u64 ticks_left;
|
||||
u64 sleep_ticks_left;
|
||||
|
||||
Stack stack;
|
||||
|
||||
ThreadState state = ThreadState::Runnable;
|
||||
|
||||
bool is_idle()
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
struct Stack
|
||||
{
|
||||
Stack() = default;
|
||||
Stack(u64 base, usize bytes);
|
||||
|
||||
u64 bottom()
|
||||
|
Loading…
Reference in New Issue
Block a user