diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-03-09 03:39:41 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-27 17:35:42 +0200 |
commit | ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1 (patch) | |
tree | ec11dc90eb2cad49237eecc98766f61b04724254 /src/core/hle/kernel/kernel.cpp | |
parent | Scheduler: Set last running time on thread. (diff) | |
download | yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.tar yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.tar.gz yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.tar.bz2 yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.tar.lz yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.tar.xz yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.tar.zst yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 721ab1e70..4a091ea38 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -113,6 +113,10 @@ struct KernelCore::Impl { explicit Impl(Core::System& system, KernelCore& kernel) : global_scheduler{kernel}, synchronization{system}, time_manager{system}, system{system} {} + void SetMulticore(bool is_multicore) { + this->is_multicore = is_multicore; + } + void Initialize(KernelCore& kernel) { Shutdown(); @@ -237,6 +241,9 @@ struct KernelCore::Impl { void RegisterCoreThread(std::size_t core_id) { std::unique_lock lock{register_thread_mutex}; + if (!is_multicore) { + single_core_thread_id = std::this_thread::get_id(); + } const std::thread::id this_id = std::this_thread::get_id(); const auto it = host_thread_ids.find(this_id); ASSERT(core_id < Core::Hardware::NUM_CPU_CORES); @@ -258,6 +265,11 @@ struct KernelCore::Impl { u32 GetCurrentHostThreadID() const { const std::thread::id this_id = std::this_thread::get_id(); + if (!is_multicore) { + if (single_core_thread_id == this_id) { + return static_cast<u32>(system.GetCpuManager().CurrentCore()); + } + } const auto it = host_thread_ids.find(this_id); if (it == host_thread_ids.end()) { return Core::INVALID_HOST_THREAD_ID; @@ -378,6 +390,9 @@ struct KernelCore::Impl { std::array<std::shared_ptr<Thread>, Core::Hardware::NUM_CPU_CORES> suspend_threads{}; + bool is_multicore{}; + std::thread::id single_core_thread_id{}; + // System context Core::System& system; }; @@ -387,6 +402,10 @@ KernelCore::~KernelCore() { Shutdown(); } +void KernelCore::SetMulticore(bool is_multicore) { + impl->SetMulticore(is_multicore); +} + void KernelCore::Initialize() { impl->Initialize(*this); } |