summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-04-07 03:58:05 +0200
committerbunnei <bunneidev@gmail.com>2015-04-10 01:06:42 +0200
commitc077bcefa9e72078ab9df798f41376c0b91abd15 (patch)
tree9afdf79102644efc26bbaec762aaee72ebcdfb1f
parentKernel: Implemented priority inheritance for mutexes. (diff)
downloadyuzu-c077bcefa9e72078ab9df798f41376c0b91abd15.tar
yuzu-c077bcefa9e72078ab9df798f41376c0b91abd15.tar.gz
yuzu-c077bcefa9e72078ab9df798f41376c0b91abd15.tar.bz2
yuzu-c077bcefa9e72078ab9df798f41376c0b91abd15.tar.lz
yuzu-c077bcefa9e72078ab9df798f41376c0b91abd15.tar.xz
yuzu-c077bcefa9e72078ab9df798f41376c0b91abd15.tar.zst
yuzu-c077bcefa9e72078ab9df798f41376c0b91abd15.zip
-rw-r--r--src/core/hle/kernel/address_arbiter.cpp4
-rw-r--r--src/core/hle/svc.cpp24
2 files changed, 22 insertions, 6 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp
index 42f8ce2d9..19135266c 100644
--- a/src/core/hle/kernel/address_arbiter.cpp
+++ b/src/core/hle/kernel/address_arbiter.cpp
@@ -46,14 +46,12 @@ ResultCode AddressArbiter::ArbitrateAddress(ArbitrationType type, VAddr address,
case ArbitrationType::WaitIfLessThan:
if ((s32)Memory::Read32(address) <= value) {
Kernel::WaitCurrentThread_ArbitrateAddress(address);
- HLE::Reschedule(__func__);
}
break;
case ArbitrationType::WaitIfLessThanWithTimeout:
if ((s32)Memory::Read32(address) <= value) {
Kernel::WaitCurrentThread_ArbitrateAddress(address);
GetCurrentThread()->WakeAfterDelay(nanoseconds);
- HLE::Reschedule(__func__);
}
break;
case ArbitrationType::DecrementAndWaitIfLessThan:
@@ -62,7 +60,6 @@ ResultCode AddressArbiter::ArbitrateAddress(ArbitrationType type, VAddr address,
Memory::Write32(address, memory_value);
if (memory_value <= value) {
Kernel::WaitCurrentThread_ArbitrateAddress(address);
- HLE::Reschedule(__func__);
}
break;
}
@@ -73,7 +70,6 @@ ResultCode AddressArbiter::ArbitrateAddress(ArbitrationType type, VAddr address,
if (memory_value <= value) {
Kernel::WaitCurrentThread_ArbitrateAddress(address);
GetCurrentThread()->WakeAfterDelay(nanoseconds);
- HLE::Reschedule(__func__);
}
break;
}
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 82e187466..43b7e5cbf 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -283,8 +283,13 @@ static ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 val
if (arbiter == nullptr)
return ERR_INVALID_HANDLE;
- return arbiter->ArbitrateAddress(static_cast<Kernel::ArbitrationType>(type),
- address, value, nanoseconds);
+ auto res = arbiter->ArbitrateAddress(static_cast<Kernel::ArbitrationType>(type),
+ address, value, nanoseconds);
+
+ if (res == RESULT_SUCCESS)
+ HLE::Reschedule(__func__);
+
+ return res;
}
/// Used to output a message on a debug hardware unit - does nothing on a retail unit
@@ -386,8 +391,11 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) {
SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0);
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(mutex)));
+ HLE::Reschedule(__func__);
+
LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X",
initial_locked ? "true" : "false", *out_handle);
+
return RESULT_SUCCESS;
}
@@ -402,6 +410,9 @@ static ResultCode ReleaseMutex(Handle handle) {
return ERR_INVALID_HANDLE;
mutex->Release();
+
+ HLE::Reschedule(__func__);
+
return RESULT_SUCCESS;
}
@@ -440,6 +451,9 @@ static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count)
return ERR_INVALID_HANDLE;
CASCADE_RESULT(*count, semaphore->Release(release_count));
+
+ HLE::Reschedule(__func__);
+
return RESULT_SUCCESS;
}
@@ -532,6 +546,9 @@ static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) {
return ERR_INVALID_HANDLE;
timer->Set(initial, interval);
+
+ HLE::Reschedule(__func__);
+
return RESULT_SUCCESS;
}
@@ -546,6 +563,9 @@ static ResultCode CancelTimer(Handle handle) {
return ERR_INVALID_HANDLE;
timer->Cancel();
+
+ HLE::Reschedule(__func__);
+
return RESULT_SUCCESS;
}