[orbis-kernel] Implement umtx_nwake_private

This commit is contained in:
Ivan Chikish 2023-07-12 13:17:53 +03:00
parent fa2db8ed4b
commit 123321e2bc
3 changed files with 13 additions and 7 deletions

View file

@ -92,7 +92,7 @@ ErrorCode umtx_sem_wait(Thread *thread, ptr<void> obj, std::int64_t val,
ptr<void> uaddr1, ptr<void> uaddr2);
ErrorCode umtx_sem_wake(Thread *thread, ptr<void> obj, std::int64_t val,
ptr<void> uaddr1, ptr<void> uaddr2);
ErrorCode umtx_nwake_private(Thread *thread, ptr<void> uaddrs,
ErrorCode umtx_nwake_private(Thread *thread, ptr<void *> uaddrs,
std::int64_t count);
ErrorCode umtx_wake2_umutex(Thread *thread, ptr<void> obj, std::int64_t val,
ptr<void> uaddr1, ptr<void> uaddr2);

View file

@ -142,7 +142,7 @@ orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
case 20:
return umtx_sem_wake(thread, obj, val, uaddr1, uaddr2);
case 21:
return umtx_nwake_private(thread, obj, val);
return umtx_nwake_private(thread, (ptr<void *>)obj, val);
case 22:
return umtx_wake2_umutex(thread, obj, val, uaddr1, uaddr2);
}

View file

@ -354,8 +354,7 @@ orbis::ErrorCode orbis::umtx_rw_unlock(Thread *thread, ptr<void> obj,
orbis::ErrorCode orbis::umtx_wake_private(Thread *thread, ptr<void> uaddr,
sint n_wake) {
ORBIS_LOG_TODO(__FUNCTION__, uaddr, n_wake);
return ErrorCode::NOSYS;
return umtx_wake(thread, uaddr, n_wake);
}
orbis::ErrorCode orbis::umtx_wait_umutex(Thread *thread, ptr<umutex> m,
@ -406,10 +405,17 @@ orbis::ErrorCode orbis::umtx_sem_wake(Thread *thread, ptr<void> obj,
return ErrorCode::NOSYS;
}
orbis::ErrorCode orbis::umtx_nwake_private(Thread *thread, ptr<void> uaddrs,
orbis::ErrorCode orbis::umtx_nwake_private(Thread *thread, ptr<void *> uaddrs,
std::int64_t count) {
ORBIS_LOG_TODO(__FUNCTION__, uaddrs, count);
return ErrorCode::NOSYS;
ORBIS_LOG_NOTICE(__FUNCTION__, uaddrs, count);
while (count-- > 0) {
void *uaddr;
auto error = uread(uaddr, uaddrs);
if (error != ErrorCode{})
return error;
umtx_wake_private(thread, uaddr, 1);
}
return {};
}
orbis::ErrorCode orbis::umtx_wake2_umutex(Thread *thread, ptr<void> obj,