[Kernel] Add scePthreadSemTimedwait

Co-authored-by: Sekai <140012992+igettingit@users.noreply.github.com>
This commit is contained in:
ParantezTech 2026-10-06 13:44:48 +03:00
parent 4d2b7035d9
commit 5c71314661
1 changed files with 29 additions and 0 deletions

View File

@ -576,6 +576,35 @@ public static class KernelSemaphoreCompatExports
: result;
}
[SysAbiExport(
Nid = "fjN6NQHhK8k",
ExportName = "scePthreadSemTimedwait",
Target = Generation.Gen4 | Generation.Gen5,
LibraryName = "libKernel")]
public static int PthreadSemTimedWait(CpuContext ctx)
{
var timeoutUsec = unchecked((uint)ctx[CpuRegister.Rsi]);
if (!TryGetPosixSemaphoreHandle(ctx, ctx[CpuRegister.Rdi], out var handle))
{
return SetReturn(ctx, OrbisGen2Result.ORBIS_GEN2_ERROR_INVALID_ARGUMENT);
}
if (!_semaphores.TryGetValue(handle, out var semaphore))
{
return SetReturn(ctx, OrbisGen2Result.ORBIS_GEN2_ERROR_NOT_FOUND);
}
return WaitSemaphoreCore(
ctx,
semaphore,
handle,
needCount: 1,
hasTimeout: true,
timeoutAddress: 0,
timeoutUsec,
"scePthreadSemTimedwait");
}
[SysAbiExport(
Nid = "w5IHyvahg-o",
ExportName = "sem_timedwait",