diff options
| author | 2020-03-08 16:20:05 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:40 -0400 | |
| commit | 9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3 (patch) | |
| tree | e977aa6c71954d9a147a20c190a425df23851085 /src/core | |
| parent | Kernel: Fixes, corrections and asserts to scheduler and different svcs. (diff) | |
| download | yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.tar.gz yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.tar.xz yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.zip | |
Kernel: Corrections to TimeManager, Scheduler and Mutex.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/kernel/mutex.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/time_manager.cpp | 5 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 5a96d5e90..32dc1ffae 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -35,8 +35,6 @@ static std::pair<std::shared_ptr<Thread>, u32> GetHighestPriorityMutexWaitingThr | |||
| 35 | if (thread->GetMutexWaitAddress() != mutex_addr) | 35 | if (thread->GetMutexWaitAddress() != mutex_addr) |
| 36 | continue; | 36 | continue; |
| 37 | 37 | ||
| 38 | ASSERT(thread->GetStatus() == ThreadStatus::WaitMutex); | ||
| 39 | |||
| 40 | ++num_waiters; | 38 | ++num_waiters; |
| 41 | if (highest_priority_thread == nullptr || | 39 | if (highest_priority_thread == nullptr || |
| 42 | thread->GetPriority() < highest_priority_thread->GetPriority()) { | 40 | thread->GetPriority() < highest_priority_thread->GetPriority()) { |
| @@ -50,6 +48,7 @@ static std::pair<std::shared_ptr<Thread>, u32> GetHighestPriorityMutexWaitingThr | |||
| 50 | /// Update the mutex owner field of all threads waiting on the mutex to point to the new owner. | 48 | /// Update the mutex owner field of all threads waiting on the mutex to point to the new owner. |
| 51 | static void TransferMutexOwnership(VAddr mutex_addr, std::shared_ptr<Thread> current_thread, | 49 | static void TransferMutexOwnership(VAddr mutex_addr, std::shared_ptr<Thread> current_thread, |
| 52 | std::shared_ptr<Thread> new_owner) { | 50 | std::shared_ptr<Thread> new_owner) { |
| 51 | current_thread->RemoveMutexWaiter(new_owner); | ||
| 53 | const auto threads = current_thread->GetMutexWaitingThreads(); | 52 | const auto threads = current_thread->GetMutexWaitingThreads(); |
| 54 | for (const auto& thread : threads) { | 53 | for (const auto& thread : threads) { |
| 55 | if (thread->GetMutexWaitAddress() != mutex_addr) | 54 | if (thread->GetMutexWaitAddress() != mutex_addr) |
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 5322f0aae..98fbb8fe5 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -93,7 +93,7 @@ u32 GlobalScheduler::SelectThreads() { | |||
| 93 | iter++; | 93 | iter++; |
| 94 | s32 suggested_core_id = suggested->GetProcessorID(); | 94 | s32 suggested_core_id = suggested->GetProcessorID(); |
| 95 | Thread* top_thread = | 95 | Thread* top_thread = |
| 96 | suggested_core_id > 0 ? top_threads[suggested_core_id] : nullptr; | 96 | suggested_core_id >= 0 ? top_threads[suggested_core_id] : nullptr; |
| 97 | if (top_thread != suggested) { | 97 | if (top_thread != suggested) { |
| 98 | if (top_thread != nullptr && | 98 | if (top_thread != nullptr && |
| 99 | top_thread->GetPriority() < THREADPRIO_MAX_CORE_MIGRATION) { | 99 | top_thread->GetPriority() < THREADPRIO_MAX_CORE_MIGRATION) { |
diff --git a/src/core/hle/kernel/time_manager.cpp b/src/core/hle/kernel/time_manager.cpp index cc228f5f7..941305e8e 100644 --- a/src/core/hle/kernel/time_manager.cpp +++ b/src/core/hle/kernel/time_manager.cpp | |||
| @@ -32,8 +32,9 @@ void TimeManager::ScheduleTimeEvent(Handle& event_handle, Thread* timetask, s64 | |||
| 32 | event_handle = timetask->GetGlobalHandle(); | 32 | event_handle = timetask->GetGlobalHandle(); |
| 33 | if (nanoseconds > 0) { | 33 | if (nanoseconds > 0) { |
| 34 | ASSERT(timetask); | 34 | ASSERT(timetask); |
| 35 | const s64 cycles = Core::Timing::nsToCycles(std::chrono::nanoseconds{nanoseconds}); | 35 | ASSERT(timetask->GetStatus() != ThreadStatus::Ready); |
| 36 | system.CoreTiming().ScheduleEvent(cycles, time_manager_event_type, event_handle); | 36 | ASSERT(timetask->GetStatus() != ThreadStatus::WaitMutex); |
| 37 | system.CoreTiming().ScheduleEvent(nanoseconds, time_manager_event_type, event_handle); | ||
| 37 | } else { | 38 | } else { |
| 38 | event_handle = InvalidHandle; | 39 | event_handle = InvalidHandle; |
| 39 | } | 40 | } |