diff options
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 7208bbb11..8663fe5ee 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -389,13 +389,13 @@ bool Thread::YieldAndWaitForLoadBalancing() { | |||
| 389 | 389 | ||
| 390 | void Thread::SetSchedulingStatus(ThreadSchedStatus new_status) { | 390 | void Thread::SetSchedulingStatus(ThreadSchedStatus new_status) { |
| 391 | const u32 old_flags = scheduling_state; | 391 | const u32 old_flags = scheduling_state; |
| 392 | scheduling_state = | 392 | scheduling_state = (scheduling_state & static_cast<u32>(ThreadSchedMasks::HighMask)) | |
| 393 | (scheduling_state & ThreadSchedMasks::HighMask) | static_cast<u32>(new_status); | 393 | static_cast<u32>(new_status); |
| 394 | AdjustSchedulingOnStatus(old_flags); | 394 | AdjustSchedulingOnStatus(old_flags); |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | void Thread::SetCurrentPriority(u32 new_priority) { | 397 | void Thread::SetCurrentPriority(u32 new_priority) { |
| 398 | u32 old_priority = std::exchange(current_priority, new_priority); | 398 | const u32 old_priority = std::exchange(current_priority, new_priority); |
| 399 | AdjustSchedulingOnPriority(old_priority); | 399 | AdjustSchedulingOnPriority(old_priority); |
| 400 | } | 400 | } |
| 401 | 401 | ||
| @@ -410,10 +410,9 @@ ResultCode Thread::SetCoreAndAffinityMask(s32 new_core, u64 new_affinity_mask) { | |||
| 410 | }; | 410 | }; |
| 411 | 411 | ||
| 412 | const bool use_override = affinity_override_count != 0; | 412 | const bool use_override = affinity_override_count != 0; |
| 413 | // The value -3 is "do not change the ideal core". | 413 | if (new_core == static_cast<s32>(CoreFlags::DontChangeIdealCore)) { |
| 414 | if (new_core == -3) { | ||
| 415 | new_core = use_override ? ideal_core_override : ideal_core; | 414 | new_core = use_override ? ideal_core_override : ideal_core; |
| 416 | if ((new_affinity_mask & (1 << new_core)) == 0) { | 415 | if ((new_affinity_mask & (1ULL << new_core)) == 0) { |
| 417 | return ERR_INVALID_COMBINATION; | 416 | return ERR_INVALID_COMBINATION; |
| 418 | } | 417 | } |
| 419 | } | 418 | } |
| @@ -444,14 +443,14 @@ void Thread::AdjustSchedulingOnStatus(u32 old_flags) { | |||
| 444 | } | 443 | } |
| 445 | 444 | ||
| 446 | auto& scheduler = kernel.GlobalScheduler(); | 445 | auto& scheduler = kernel.GlobalScheduler(); |
| 447 | if (static_cast<ThreadSchedStatus>(old_flags & ThreadSchedMasks::LowMask) == | 446 | if (static_cast<ThreadSchedStatus>(old_flags & static_cast<u32>(ThreadSchedMasks::LowMask)) == |
| 448 | ThreadSchedStatus::Runnable) { | 447 | ThreadSchedStatus::Runnable) { |
| 449 | // In this case the thread was running, now it's pausing/exitting | 448 | // In this case the thread was running, now it's pausing/exitting |
| 450 | if (processor_id >= 0) { | 449 | if (processor_id >= 0) { |
| 451 | scheduler.Unschedule(current_priority, processor_id, this); | 450 | scheduler.Unschedule(current_priority, processor_id, this); |
| 452 | } | 451 | } |
| 453 | 452 | ||
| 454 | for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) { | 453 | for (s32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) { |
| 455 | if (core != processor_id && ((affinity_mask >> core) & 1) != 0) { | 454 | if (core != processor_id && ((affinity_mask >> core) & 1) != 0) { |
| 456 | scheduler.Unsuggest(current_priority, core, this); | 455 | scheduler.Unsuggest(current_priority, core, this); |
| 457 | } | 456 | } |
| @@ -462,7 +461,7 @@ void Thread::AdjustSchedulingOnStatus(u32 old_flags) { | |||
| 462 | scheduler.Schedule(current_priority, processor_id, this); | 461 | scheduler.Schedule(current_priority, processor_id, this); |
| 463 | } | 462 | } |
| 464 | 463 | ||
| 465 | for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) { | 464 | for (s32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) { |
| 466 | if (core != processor_id && ((affinity_mask >> core) & 1) != 0) { | 465 | if (core != processor_id && ((affinity_mask >> core) & 1) != 0) { |
| 467 | scheduler.Suggest(current_priority, core, this); | 466 | scheduler.Suggest(current_priority, core, this); |
| 468 | } | 467 | } |