diff options
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r-- | src/core/core.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 2cfae18df..50f0a42fb 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -14,6 +14,9 @@ #include "core/core.h" #include "core/core_cpu.h" #include "core/core_timing.h" +#include "core/file_sys/mode.h" +#include "core/file_sys/vfs_concat.h" +#include "core/file_sys/vfs_real.h" #include "core/gdbstub/gdbstub.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/kernel.h" @@ -21,14 +24,11 @@ #include "core/hle/kernel/scheduler.h" #include "core/hle/kernel/thread.h" #include "core/hle/service/service.h" -#include "core/hle/service/sm/controller.h" #include "core/hle/service/sm/sm.h" #include "core/loader/loader.h" #include "core/perf_stats.h" #include "core/settings.h" #include "core/telemetry_session.h" -#include "file_sys/vfs_concat.h" -#include "file_sys/vfs_real.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/gpu.h" #include "video_core/renderer_base.h" @@ -136,11 +136,11 @@ struct System::Impl { if (virtual_filesystem == nullptr) virtual_filesystem = std::make_shared<FileSys::RealVfsFilesystem>(); - current_process = Kernel::Process::Create(kernel, "main"); + kernel.MakeCurrentProcess(Kernel::Process::Create(kernel, "main")); cpu_barrier = std::make_shared<CpuBarrier>(); cpu_exclusive_monitor = Cpu::MakeExclusiveMonitor(cpu_cores.size()); - for (size_t index = 0; index < cpu_cores.size(); ++index) { + for (std::size_t index = 0; index < cpu_cores.size(); ++index) { cpu_cores[index] = std::make_shared<Cpu>(cpu_exclusive_monitor, cpu_barrier, index); } @@ -161,7 +161,7 @@ struct System::Impl { // CPU core 0 is run on the main thread thread_to_cpu[std::this_thread::get_id()] = cpu_cores[0]; if (Settings::values.use_multi_core) { - for (size_t index = 0; index < cpu_core_threads.size(); ++index) { + for (std::size_t index = 0; index < cpu_core_threads.size(); ++index) { cpu_core_threads[index] = std::make_unique<std::thread>(RunCpuCore, cpu_cores[index + 1]); thread_to_cpu[cpu_core_threads[index]->get_id()] = cpu_cores[index + 1]; @@ -202,7 +202,7 @@ struct System::Impl { return init_result; } - const Loader::ResultStatus load_result{app_loader->Load(current_process)}; + const Loader::ResultStatus load_result{app_loader->Load(kernel.CurrentProcess())}; if (load_result != Loader::ResultStatus::Success) { LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<int>(load_result)); Shutdown(); @@ -281,12 +281,11 @@ struct System::Impl { std::unique_ptr<VideoCore::RendererBase> renderer; std::unique_ptr<Tegra::GPU> gpu_core; std::shared_ptr<Tegra::DebugContext> debug_context; - Kernel::SharedPtr<Kernel::Process> current_process; std::shared_ptr<ExclusiveMonitor> cpu_exclusive_monitor; std::shared_ptr<CpuBarrier> cpu_barrier; std::array<std::shared_ptr<Cpu>, NUM_CPU_CORES> cpu_cores; std::array<std::unique_ptr<std::thread>, NUM_CPU_CORES - 1> cpu_core_threads; - size_t active_core{}; ///< Active core, only used in single thread mode + std::size_t active_core{}; ///< Active core, only used in single thread mode /// Service manager std::shared_ptr<Service::SM::ServiceManager> service_manager; @@ -349,7 +348,7 @@ ARM_Interface& System::CurrentArmInterface() { return CurrentCpuCore().ArmInterface(); } -size_t System::CurrentCoreIndex() { +std::size_t System::CurrentCoreIndex() { return CurrentCpuCore().CoreIndex(); } @@ -357,21 +356,25 @@ Kernel::Scheduler& System::CurrentScheduler() { return *CurrentCpuCore().Scheduler(); } -const std::shared_ptr<Kernel::Scheduler>& System::Scheduler(size_t core_index) { +const std::shared_ptr<Kernel::Scheduler>& System::Scheduler(std::size_t core_index) { ASSERT(core_index < NUM_CPU_CORES); return impl->cpu_cores[core_index]->Scheduler(); } Kernel::SharedPtr<Kernel::Process>& System::CurrentProcess() { - return impl->current_process; + return impl->kernel.CurrentProcess(); } -ARM_Interface& System::ArmInterface(size_t core_index) { +const Kernel::SharedPtr<Kernel::Process>& System::CurrentProcess() const { + return impl->kernel.CurrentProcess(); +} + +ARM_Interface& System::ArmInterface(std::size_t core_index) { ASSERT(core_index < NUM_CPU_CORES); return impl->cpu_cores[core_index]->ArmInterface(); } -Cpu& System::CpuCore(size_t core_index) { +Cpu& System::CpuCore(std::size_t core_index) { ASSERT(core_index < NUM_CPU_CORES); return *impl->cpu_cores[core_index]; } @@ -440,8 +443,8 @@ void System::SetGPUDebugContext(std::shared_ptr<Tegra::DebugContext> context) { impl->debug_context = std::move(context); } -std::shared_ptr<Tegra::DebugContext> System::GetGPUDebugContext() const { - return impl->debug_context; +Tegra::DebugContext* System::GetGPUDebugContext() const { + return impl->debug_context.get(); } void System::SetFilesystem(std::shared_ptr<FileSys::VfsFilesystem> vfs) { |