summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-12-04 19:59:29 -0500
committerGravatar Lioncash2018-12-04 20:14:59 -0500
commit2f253986df3e5cf5aca0bb2fcec2e23c0cab57d7 (patch)
treed1ab3e29f5c02689b19a954231dd102b1cf3b745 /src/core/hle/kernel/svc.cpp
parentkernel/process: Make Process a WaitObject (diff)
downloadyuzu-2f253986df3e5cf5aca0bb2fcec2e23c0cab57d7.tar.gz
yuzu-2f253986df3e5cf5aca0bb2fcec2e23c0cab57d7.tar.xz
yuzu-2f253986df3e5cf5aca0bb2fcec2e23c0cab57d7.zip
kernel/svc: Correct behavior of svcResetSignal()
While partially correct, this service call allows the retrieved event to be null, as it also uses the same handle to check if it was referring to a Process instance. The previous two changes put the necessary machinery in place to allow for this, so we can simply call those member functions here and be done with it.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index e6c77f9db..84df2040e 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1433,17 +1433,24 @@ static ResultCode CloseHandle(Handle handle) {
1433 return handle_table.Close(handle); 1433 return handle_table.Close(handle);
1434} 1434}
1435 1435
1436/// Reset an event 1436/// Clears the signaled state of an event or process.
1437static ResultCode ResetSignal(Handle handle) { 1437static ResultCode ResetSignal(Handle handle) {
1438 LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle); 1438 LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
1439 1439
1440 const auto& handle_table = Core::CurrentProcess()->GetHandleTable(); 1440 const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
1441
1441 auto event = handle_table.Get<ReadableEvent>(handle); 1442 auto event = handle_table.Get<ReadableEvent>(handle);
1443 if (event) {
1444 return event->Reset();
1445 }
1442 1446
1443 ASSERT(event != nullptr); 1447 auto process = handle_table.Get<Process>(handle);
1448 if (process) {
1449 return process->ClearSignalState();
1450 }
1444 1451
1445 event->Clear(); 1452 LOG_ERROR(Kernel_SVC, "Invalid handle (0x{:08X})", handle);
1446 return RESULT_SUCCESS; 1453 return ERR_INVALID_HANDLE;
1447} 1454}
1448 1455
1449/// Creates a TransferMemory object 1456/// Creates a TransferMemory object