mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-13 14:44:23 -04:00
kern: mostly implement KThread::Initialize
This commit is contained in:
parent
d9db723bc8
commit
b2b1129cc0
11 changed files with 383 additions and 15 deletions
|
@ -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. */
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue