Эх сурвалжийг харах

Merge pull request #226 from bunnei/svc-and-thread-fixes

Svc and thread fixes
bunnei 11 жил өмнө
parent
commit
a5afad0937

+ 1 - 1
src/core/hle/kernel/thread.cpp

@@ -143,7 +143,7 @@ void ChangeReadyState(Thread* t, bool ready) {
 /// Verify that a thread has not been released from waiting
 inline bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle) {
     _dbg_assert_(KERNEL, thread != nullptr);
-    return type == thread->wait_type && wait_handle == thread->wait_handle;
+    return (type == thread->wait_type) && (wait_handle == thread->wait_handle) && (thread->IsWaiting());
 }
 
 /// Stops the current thread

+ 5 - 0
src/core/hle/svc.cpp

@@ -189,6 +189,8 @@ static Result CreateAddressArbiter(u32* arbiter) {
 
 /// Arbitrate address
 static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) {
+    DEBUG_LOG(SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter,
+        address, type, value);
     return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type),
             address, value).raw;
 }
@@ -331,6 +333,9 @@ static Result ClearEvent(Handle evt) {
 /// Sleep the current thread
 static void SleepThread(s64 nanoseconds) {
     DEBUG_LOG(SVC, "called nanoseconds=%lld", nanoseconds);
+
+    // Check for next thread to schedule
+    HLE::Reschedule(__func__);
 }
 
 /// This returns the total CPU ticks elapsed since the CPU was powered-on