diff options
author | bunnei <bunneidev@gmail.com> | 2021-01-20 06:07:07 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-01-29 06:42:26 +0100 |
commit | 1f99f5473c7a03c791ea20256c7fc2f1caba8adc (patch) | |
tree | 3dea03c0082e6685aeda2769fd7b186f0afbf46c /src/core/hle/kernel/kernel.cpp | |
parent | hle: kernel: TimeManager: Simplify to not rely on previous EmuThreadHandle implementation. (diff) | |
download | yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.tar yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.tar.gz yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.tar.bz2 yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.tar.lz yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.tar.xz yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.tar.zst yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.zip |
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 97a5dc2e0..39d5122f5 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -237,20 +237,13 @@ struct KernelCore::Impl { is_phantom_mode_for_singlecore = value; } - [[nodiscard]] Core::EmuThreadHandle GetCurrentEmuThreadID() { - Core::EmuThreadHandle result = Core::EmuThreadHandle::InvalidHandle(); - result.host_handle = GetCurrentHostThreadID(); - if (result.host_handle >= Core::Hardware::NUM_CPU_CORES) { - return result; + [[nodiscard]] EmuThreadHandle GetCurrentEmuThreadID() { + const auto thread_id = GetCurrentHostThreadID(); + if (thread_id >= Core::Hardware::NUM_CPU_CORES) { + // Reserved value for HLE threads + return EmuThreadHandleReserved + (static_cast<u64>(thread_id) << 1); } - const Kernel::KScheduler& sched = cores[result.host_handle].Scheduler(); - const Kernel::KThread* current = sched.GetCurrentThread(); - if (current != nullptr && !IsPhantomModeForSingleCore()) { - result.guest_handle = current->GetGlobalHandle(); - } else { - result.guest_handle = InvalidHandle; - } - return result; + return reinterpret_cast<uintptr_t>(schedulers[thread_id].get()); } void InitializeMemoryLayout() { @@ -555,7 +548,7 @@ u32 KernelCore::GetCurrentHostThreadID() const { return impl->GetCurrentHostThreadID(); } -Core::EmuThreadHandle KernelCore::GetCurrentEmuThreadID() const { +EmuThreadHandle KernelCore::GetCurrentEmuThreadID() const { return impl->GetCurrentEmuThreadID(); } |