diff options
| author | Merry <git@mary.rs> | 2024-01-02 21:13:04 +0000 |
|---|---|---|
| committer | Merry <git@mary.rs> | 2024-01-02 21:34:34 +0000 |
| commit | d4bb92866b4240b491557d3b0bf691d4e56e2709 (patch) | |
| tree | cc793ffa918fddb241b8dd9d20a06debaaae87c9 /src/core/hle/kernel/k_thread.cpp | |
| parent | d8db5c2032c97de442d897991ab63fd8fa8e3dd8 (diff) | |
KThread: Send termination interrupt to all cores a thread has affinity to
KThread::RequestTerminate may run from a thread which is not the CurrentCore, and thus
masking this out is erroneous.
Diffstat (limited to 'src/core/hle/kernel/k_thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/k_thread.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index 24394d2228..7d3421929d 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp @@ -1258,11 +1258,11 @@ ThreadState KThread::RequestTerminate() { // Change the thread's priority to be higher than any system thread's. this->IncreaseBasePriority(TerminatingThreadPriority); - // If the thread is runnable, send a termination interrupt to other cores. + // If the thread is runnable, send a termination interrupt to cores it may be running on. if (this->GetState() == ThreadState::Runnable) { - if (const u64 core_mask = m_physical_affinity_mask.GetAffinityMask() & - ~(1ULL << GetCurrentCoreId(m_kernel)); - core_mask != 0) { + // NOTE: We do not mask the "current core", because this code may not actually be + // executing from the thread representing the "current core". + if (const u64 core_mask = m_physical_affinity_mask.GetAffinityMask(); core_mask != 0) { Kernel::KInterruptManager::SendInterProcessorInterrupt(m_kernel, core_mask); } } |
