aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-04 19:59:29 -0500
committerLioncash <mathew1800@gmail.com>2018-12-04 20:14:59 -0500
commit2f253986df3e5cf5aca0bb2fcec2e23c0cab57d7 (patch)
treed1ab3e29f5c02689b19a954231dd102b1cf3b745 /src/core/hle/kernel/svc.cpp
parentc7462ce71241fe6c8dfee48a859c63a6b1fd84fb (diff)
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 e6c77f9db8..84df2040e9 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1433,17 +1433,24 @@ static ResultCode CloseHandle(Handle handle) {
return handle_table.Close(handle);
}
-/// Reset an event
+/// Clears the signaled state of an event or process.
static ResultCode ResetSignal(Handle handle) {
LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
+
auto event = handle_table.Get<ReadableEvent>(handle);
+ if (event) {
+ return event->Reset();
+ }
- ASSERT(event != nullptr);
+ auto process = handle_table.Get<Process>(handle);
+ if (process) {
+ return process->ClearSignalState();
+ }
- event->Clear();
- return RESULT_SUCCESS;
+ LOG_ERROR(Kernel_SVC, "Invalid handle (0x{:08X})", handle);
+ return ERR_INVALID_HANDLE;
}
/// Creates a TransferMemory object