kern: mostly implement KThread::Initialize
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace ams::kern {
|
||||
|
||||
void Kernel::Initialize(s32 core_id) {
|
||||
void Kernel::InitializeCoreLocalRegion(s32 core_id) {
|
||||
/* Construct the core local region object in place. */
|
||||
KCoreLocalContext *clc = GetPointer<KCoreLocalContext>(KMemoryLayout::GetCoreLocalRegionAddress());
|
||||
new (clc) KCoreLocalContext;
|
||||
@@ -46,9 +46,22 @@ namespace ams::kern {
|
||||
}
|
||||
}
|
||||
|
||||
void Kernel::InitializeCoreThreads(s32 core_id) {
|
||||
/* TODO: This function wants to setup the main thread and the idle thread. */
|
||||
/* It also wants to initialize the scheduler/interrupt manager/hardware timer. */
|
||||
void Kernel::InitializeMainAndIdleThreads(s32 core_id) {
|
||||
/* This function wants to setup the main thread and the idle thread. */
|
||||
KThread *main_thread = std::addressof(Kernel::GetMainThread(core_id));
|
||||
void *main_thread_stack = GetVoidPointer(KMemoryLayout::GetMainStackTopAddress(core_id));
|
||||
KThread *idle_thread = std::addressof(Kernel::GetIdleThread(core_id));
|
||||
void *idle_thread_stack = GetVoidPointer(KMemoryLayout::GetIdleStackTopAddress(core_id));
|
||||
KAutoObject::Create(main_thread);
|
||||
KAutoObject::Create(idle_thread);
|
||||
main_thread->Initialize(nullptr, 0, main_thread_stack, 0, KThread::MainThreadPriority, core_id, nullptr, KThread::ThreadType_Main);
|
||||
idle_thread->Initialize(nullptr, 0, idle_thread_stack, 0, KThread::IdleThreadPriority, core_id, nullptr, KThread::ThreadType_Main);
|
||||
|
||||
/* Set the current thread to be the main thread, and we have no processes running yet. */
|
||||
SetCurrentThread(main_thread);
|
||||
SetCurrentProcess(nullptr);
|
||||
|
||||
/* TODO: We also want to initialize the scheduler/interrupt manager/hardware timer. */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user