summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-04-09 17:03:04 -0400
committerGravatar Lioncash2019-04-11 22:11:41 -0400
commit612e1388df3bed64081488f2a99cce522c80c76d (patch)
tree2d2782d0df46e9458ec2a2728f5cd66f27963ea9 /src/core/core.cpp
parentcore/process: Remove unideal page table setting from LoadFromMetadata() (diff)
downloadyuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.gz
yuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.xz
yuzu-612e1388df3bed64081488f2a99cce522c80c76d.zip
core/core: Move process execution start to System's Load()
This gives us significantly more control over where in the initialization process we start execution of the main process. Previously we were running the main process before the CPU or GPU threads were initialized (not good). This amends execution to start after all of our threads are properly set up.
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 265ac2835..175a5f2ea 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -168,7 +168,7 @@ struct System::Impl {
168 } 168 }
169 169
170 auto main_process = Kernel::Process::Create(system, "main"); 170 auto main_process = Kernel::Process::Create(system, "main");
171 const Loader::ResultStatus load_result{app_loader->Load(*main_process)}; 171 const auto [load_result, load_parameters] = app_loader->Load(*main_process);
172 if (load_result != Loader::ResultStatus::Success) { 172 if (load_result != Loader::ResultStatus::Success) {
173 LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<int>(load_result)); 173 LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<int>(load_result));
174 Shutdown(); 174 Shutdown();
@@ -183,6 +183,10 @@ struct System::Impl {
183 gpu_core->Start(); 183 gpu_core->Start();
184 cpu_core_manager.StartThreads(); 184 cpu_core_manager.StartThreads();
185 185
186 // All threads are started, begin main process execution, now that we're in the clear.
187 main_process->Run(load_parameters->main_thread_priority,
188 load_parameters->main_thread_stack_size);
189
186 status = ResultStatus::Success; 190 status = ResultStatus::Success;
187 return status; 191 return status;
188 } 192 }