aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc/svc_synchronization.cpp
diff options
context:
space:
mode:
authorDjihads <76681596+Djihads80@users.noreply.github.com>2026-10-29 02:25:36 +0100
committerGitHub <noreply@github.com>2026-10-29 02:25:36 +0100
commit0bb5055b6541c74f47603a8dff0569a509cbaf18 (patch)
treeda827ff9c4f2f9a5309ee2804ee689f608c0ac2f /src/core/hle/kernel/svc/svc_synchronization.cpp
parent1af7fe72927af9fc64aa4af117bc9b30043c4dc7 (diff)
parent535b6769709eb22333af26269f1b16f37adce4db (diff)
Merge pull request #1 from Djihads80/yumekiru/ns2-progress-v2
Experimental NS2 support and accumulated GPU fixes
Diffstat (limited to 'src/core/hle/kernel/svc/svc_synchronization.cpp')
-rw-r--r--src/core/hle/kernel/svc/svc_synchronization.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/core/hle/kernel/svc/svc_synchronization.cpp b/src/core/hle/kernel/svc/svc_synchronization.cpp
index 2b019c52d1..2f72f60215 100644
--- a/src/core/hle/kernel/svc/svc_synchronization.cpp
+++ b/src/core/hle/kernel/svc/svc_synchronization.cpp
@@ -15,13 +15,24 @@
namespace Kernel::Svc {
+namespace {
+void LogInvalidNativeSyncHandle(Core::System& system, const char* operation, Handle handle) {
+ if (!GetCurrentProcess(system.Kernel()).UsesPAuthReturns()) { return; }
+ const auto& context = GetCurrentThread(system.Kernel()).GetContext();
+ LOG_DEBUG(Kernel_SVC, "native {} invalid handle={:#x}, pc={:#x}, lr={:#x}, fp={:#x}",
+ operation, handle, context.pc, context.lr, context.fp);
+}
+}
+
/// Close a handle
Result CloseHandle(Core::System& system, Handle handle) {
LOG_TRACE(Kernel_SVC, "Closing handle {:#08x}", handle);
// Remove the handle.
- R_UNLESS(GetCurrentProcess(system.Kernel()).GetHandleTable().Remove(system.Kernel(), handle),
- ResultInvalidHandle);
+ if (!GetCurrentProcess(system.Kernel()).GetHandleTable().Remove(system.Kernel(), handle)) {
+ LogInvalidNativeSyncHandle(system, "CloseHandle", handle);
+ R_THROW(ResultInvalidHandle);
+ }
R_SUCCEED();
}
@@ -49,6 +60,7 @@ Result ResetSignal(Core::System& system, Handle handle) {
}
}
+ LogInvalidNativeSyncHandle(system, "ResetSignal", handle);
R_THROW(ResultInvalidHandle);
}
@@ -72,7 +84,10 @@ Result WaitSynchronization(Core::System& system, int32_t* out_index, u64 user_ha
R_UNLESS(GetCurrentMemory(system.Kernel()).ReadBlock(user_handles, handles.data(), sizeof(Handle) * num_handles), ResultInvalidPointer);
// Convert the handles to objects.
- R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>(system.Kernel(), objs.data(), handles.data(), num_handles), ResultInvalidHandle);
+ if (!handle_table.GetMultipleObjects<KSynchronizationObject>(system.Kernel(), objs.data(), handles.data(), num_handles)) {
+ for (s32 i = 0; i < num_handles; ++i) { LogInvalidNativeSyncHandle(system, "WaitSynchronization set", handles[i]); }
+ R_THROW(ResultInvalidHandle);
+ }
}
// Ensure handles are closed when we're done.