aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index a42cb48eb..183c5109c 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -104,7 +104,7 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
return init_result;
}
- const Loader::ResultStatus load_result{app_loader->Load(Kernel::g_current_process)};
+ const Loader::ResultStatus load_result{app_loader->Load(current_process)};
if (Loader::ResultStatus::Success != load_result) {
LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result);
System::Shutdown();
@@ -137,22 +137,26 @@ void System::Reschedule() {
}
reschedule_pending = false;
- Kernel::Reschedule();
+ Core::System::GetInstance().Scheduler().Reschedule();
}
System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
LOG_DEBUG(HW_Memory, "initialized OK");
+ CoreTiming::Init();
+
+ current_process = Kernel::Process::Create("main");
+
switch (Settings::values.cpu_core) {
case Settings::CpuCore::Unicorn:
- cpu_core = std::make_unique<ARM_Unicorn>();
+ cpu_core = std::make_shared<ARM_Unicorn>();
break;
case Settings::CpuCore::Dynarmic:
default:
#ifdef ARCHITECTURE_x86_64
- cpu_core = std::make_unique<ARM_Dynarmic>();
+ cpu_core = std::make_shared<ARM_Dynarmic>();
#else
- cpu_core = std::make_unique<ARM_Unicorn>();
+ cpu_core = std::make_shared<ARM_Unicorn>();
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
#endif
break;
@@ -162,9 +166,9 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
telemetry_session = std::make_unique<Core::TelemetrySession>();
- CoreTiming::Init();
HW::Init();
Kernel::Init(system_mode);
+ scheduler = std::make_unique<Kernel::Scheduler>(cpu_core.get());
Service::Init();
GDBStub::Init();
@@ -192,15 +196,18 @@ void System::Shutdown() {
perf_results.frametime * 1000.0);
// Shutdown emulation session
- GDBStub::Shutdown();
VideoCore::Shutdown();
+ GDBStub::Shutdown();
Service::Shutdown();
+ scheduler = nullptr;
Kernel::Shutdown();
HW::Shutdown();
- CoreTiming::Shutdown();
+ telemetry_session = nullptr;
+ gpu_core = nullptr;
cpu_core = nullptr;
+ CoreTiming::Shutdown();
+
app_loader = nullptr;
- telemetry_session = nullptr;
LOG_DEBUG(Core, "Shutdown OK");
}