summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-08 21:20:05 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:40 +0200
commit9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3 (patch)
treee977aa6c71954d9a147a20c190a425df23851085 /src/core/hle/kernel
parentKernel: Fixes, corrections and asserts to scheduler and different svcs. (diff)
downloadyuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.tar
yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.tar.gz
yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.tar.bz2
yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.tar.lz
yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.tar.xz
yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.tar.zst
yuzu-9e9c287f8b24ce9a932490cc35b3d0b5f58bb7a3.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/mutex.cpp3
-rw-r--r--src/core/hle/kernel/scheduler.cpp2
-rw-r--r--src/core/hle/kernel/time_manager.cpp5
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
if (thread->GetMutexWaitAddress() != mutex_addr)
continue;
- ASSERT(thread->GetStatus() == ThreadStatus::WaitMutex);
-
++num_waiters;
if (highest_priority_thread == nullptr ||
thread->GetPriority() < highest_priority_thread->GetPriority()) {
@@ -50,6 +48,7 @@ static std::pair<std::shared_ptr<Thread>, u32> GetHighestPriorityMutexWaitingThr
/// Update the mutex owner field of all threads waiting on the mutex to point to the new owner.
static void TransferMutexOwnership(VAddr mutex_addr, std::shared_ptr<Thread> current_thread,
std::shared_ptr<Thread> new_owner) {
+ current_thread->RemoveMutexWaiter(new_owner);
const auto threads = current_thread->GetMutexWaitingThreads();
for (const auto& thread : threads) {
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() {
iter++;
s32 suggested_core_id = suggested->GetProcessorID();
Thread* top_thread =
- suggested_core_id > 0 ? top_threads[suggested_core_id] : nullptr;
+ suggested_core_id >= 0 ? top_threads[suggested_core_id] : nullptr;
if (top_thread != suggested) {
if (top_thread != nullptr &&
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
event_handle = timetask->GetGlobalHandle();
if (nanoseconds > 0) {
ASSERT(timetask);
- const s64 cycles = Core::Timing::nsToCycles(std::chrono::nanoseconds{nanoseconds});
- system.CoreTiming().ScheduleEvent(cycles, time_manager_event_type, event_handle);
+ ASSERT(timetask->GetStatus() != ThreadStatus::Ready);
+ ASSERT(timetask->GetStatus() != ThreadStatus::WaitMutex);
+ system.CoreTiming().ScheduleEvent(nanoseconds, time_manager_event_type, event_handle);
} else {
event_handle = InvalidHandle;
}