mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 14:37:08 +00:00
[orbis-kernel] Implement umtx_wait_uint within umtx_wait
Remove separate functions: * umtx_wait_uint * umtx_wait_uint_private
This commit is contained in:
parent
eda542561c
commit
4020bc1108
3 changed files with 17 additions and 24 deletions
|
|
@ -81,7 +81,9 @@ orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
|
|||
return umtx_unlock_umtx(thread, (ptr<umtx>)obj, val);
|
||||
case 2: {
|
||||
return with_timeout(
|
||||
[&](std::uint64_t ut) { return umtx_wait(thread, obj, val, ut); },
|
||||
[&](std::uint64_t ut) {
|
||||
return umtx_wait(thread, obj, val, ut, false);
|
||||
},
|
||||
false);
|
||||
}
|
||||
case 3:
|
||||
|
|
@ -112,7 +114,8 @@ orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
|
|||
return umtx_cv_broadcast(thread, (ptr<ucond>)obj);
|
||||
case 11: {
|
||||
return with_timeout(
|
||||
[&](std::uint64_t ut) { return umtx_wait_uint(thread, obj, val, ut); });
|
||||
[&](std::uint64_t ut) { return umtx_wait(thread, obj, val, ut, true); },
|
||||
false);
|
||||
}
|
||||
case 12:
|
||||
return umtx_rw_rdlock(thread, obj, val, uaddr1, uaddr2);
|
||||
|
|
@ -121,9 +124,9 @@ orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
|
|||
case 14:
|
||||
return umtx_rw_unlock(thread, obj, val, uaddr1, uaddr2);
|
||||
case 15: {
|
||||
return with_timeout([&](std::uint64_t ut) {
|
||||
return umtx_wait_uint_private(thread, obj, val, ut);
|
||||
});
|
||||
return with_timeout(
|
||||
[&](std::uint64_t ut) { return umtx_wait(thread, obj, val, ut, true); },
|
||||
false);
|
||||
}
|
||||
case 16:
|
||||
return umtx_wake_private(thread, obj, val);
|
||||
|
|
|
|||
|
|
@ -59,12 +59,17 @@ orbis::ErrorCode orbis::umtx_unlock_umtx(Thread *thread, ptr<umtx> umtx,
|
|||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wait(Thread *thread, ptr<void> addr, ulong id,
|
||||
std::uint64_t ut) {
|
||||
std::uint64_t ut, bool is32) {
|
||||
ORBIS_LOG_NOTICE(__FUNCTION__, addr, id, ut);
|
||||
auto [chain, key, lock] = g_context.getUmtxChain0(thread->tproc->pid, addr);
|
||||
auto node = chain.enqueue(key, thread);
|
||||
ErrorCode result = {};
|
||||
if (reinterpret_cast<ptr<std::atomic<ulong>>>(addr)->load() == id) {
|
||||
ulong val = 0;
|
||||
if (is32)
|
||||
val = reinterpret_cast<ptr<std::atomic<uint>>>(addr)->load();
|
||||
else
|
||||
val = reinterpret_cast<ptr<std::atomic<ulong>>>(addr)->load();
|
||||
if (val == id) {
|
||||
if (ut + 1 == 0) {
|
||||
node->second.cv.wait(chain.mtx);
|
||||
} else {
|
||||
|
|
@ -326,12 +331,6 @@ orbis::ErrorCode orbis::umtx_cv_broadcast(Thread *thread, ptr<ucond> cv) {
|
|||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wait_uint(Thread *thread, ptr<void> addr, ulong id,
|
||||
std::uint64_t ut) {
|
||||
ORBIS_LOG_TODO(__FUNCTION__, addr, id, ut);
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_rw_rdlock(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
|
|
@ -353,12 +352,6 @@ orbis::ErrorCode orbis::umtx_rw_unlock(Thread *thread, ptr<void> obj,
|
|||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wait_uint_private(Thread *thread, ptr<void> addr,
|
||||
ulong id, std::uint64_t ut) {
|
||||
ORBIS_LOG_TODO(__FUNCTION__, addr, id, ut);
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wake_private(Thread *thread, ptr<void> uaddr,
|
||||
sint n_wake) {
|
||||
ORBIS_LOG_TODO(__FUNCTION__, uaddr, n_wake);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue