mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 02:33:44 -04:00
kernel: extend NullWaitObject fix to WaitSynchronization1 (svc 0x24)
The previous NullWaitObject fix only covered WaitSynchronizationN (0x25). WaitSynchronization1 (0x24) had the same issue: handle=0 returned ResultInvalidHandle immediately, crashing any process whose wait handle had not been populated yet. Apply the same fix: handle=0 is substituted with a NullWaitObject so the thread sleeps until the timeout expires and receives ResultTimeout, matching real hardware behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8d9f605fbb
commit
f2250fa485
1 changed files with 9 additions and 1 deletions
|
|
@ -827,7 +827,15 @@ private:
|
|||
Result SVC::WaitSynchronization1(Handle handle, s64 nano_seconds) {
|
||||
auto object = kernel.GetCurrentProcess()->handle_table.Get<WaitObject>(handle);
|
||||
Thread* thread = kernel.GetCurrentThreadManager().GetCurrentThread();
|
||||
R_UNLESS(object, ResultInvalidHandle);
|
||||
if (!object) {
|
||||
// Null handle (0) behaves as a permanently-unavailable object on real hardware —
|
||||
// the thread sleeps until the timeout expires and then receives ResultTimeout.
|
||||
if (handle == 0) {
|
||||
object = std::make_shared<NullWaitObject>(kernel);
|
||||
} else {
|
||||
return ResultInvalidHandle;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({}:{}), nanoseconds={}", handle,
|
||||
object->GetTypeName(), object->GetName(), nano_seconds);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue