mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-07 01:00:06 +01:00
Merge pull request #79 from IsaacMarovitz/utmx-const
orbis-kernel: Define umtx ops in header
This commit is contained in:
commit
175ea2d623
|
|
@ -29,6 +29,30 @@ inline constexpr auto kCvWaitCheckUnparking = 0x01;
|
||||||
inline constexpr auto kCvWaitAbsTime = 0x02;
|
inline constexpr auto kCvWaitAbsTime = 0x02;
|
||||||
inline constexpr auto kCvWaitClockId = 0x04;
|
inline constexpr auto kCvWaitClockId = 0x04;
|
||||||
|
|
||||||
|
inline constexpr auto kUmtxOpLock = 0;
|
||||||
|
inline constexpr auto kUmtxOpUnlock = 1;
|
||||||
|
inline constexpr auto kUmtxOpWait = 2;
|
||||||
|
inline constexpr auto kUmtxOpWake = 3;
|
||||||
|
inline constexpr auto kUmtxOpMutexTrylock = 4;
|
||||||
|
inline constexpr auto kUmtxOpMutexLock = 5;
|
||||||
|
inline constexpr auto kUmtxOpMutexUnock = 6;
|
||||||
|
inline constexpr auto kUmtxOpSetCeiling = 7;
|
||||||
|
inline constexpr auto kUmtxOpCvWait = 8;
|
||||||
|
inline constexpr auto kUmtxOpCvSignal = 9;
|
||||||
|
inline constexpr auto kUmtxOpCvBroadcast = 10;
|
||||||
|
inline constexpr auto kUmtxOpWaitUint = 11;
|
||||||
|
inline constexpr auto kUmtxOpRwRdLock = 12;
|
||||||
|
inline constexpr auto kUmtxOpRwWrLock = 13;
|
||||||
|
inline constexpr auto kUmtxOpRwUnlock = 14;
|
||||||
|
inline constexpr auto kUmtxOpWaitUintPrivate = 15;
|
||||||
|
inline constexpr auto kUmtxOpWakePrivate = 16;
|
||||||
|
inline constexpr auto kUmtxOpMutexWait = 17;
|
||||||
|
inline constexpr auto kUmtxOpMutexWake = 18;
|
||||||
|
inline constexpr auto kUmtxOpSemWait = 19;
|
||||||
|
inline constexpr auto kUmtxOpSemWake = 20;
|
||||||
|
inline constexpr auto kUmtxOpNwakePrivate = 21;
|
||||||
|
inline constexpr auto kUmtxOpMutexWake2 = 22;
|
||||||
|
|
||||||
inline constexpr auto kSemNamed = 2;
|
inline constexpr auto kSemNamed = 2;
|
||||||
|
|
||||||
struct umtx {
|
struct umtx {
|
||||||
|
|
|
||||||
|
|
@ -84,36 +84,35 @@ orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case 0: {
|
case kUmtxOpLock: {
|
||||||
return with_timeout([&](std::uint64_t ut) {
|
return with_timeout([&](std::uint64_t ut) {
|
||||||
return umtx_lock_umtx(thread, (ptr<umtx>)obj, val, ut);
|
return umtx_lock_umtx(thread, (ptr<umtx>)obj, val, ut);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
case 1:
|
case kUmtxOpUnlock:
|
||||||
return umtx_unlock_umtx(thread, (ptr<umtx>)obj, val);
|
return umtx_unlock_umtx(thread, (ptr<umtx>)obj, val);
|
||||||
case 2: {
|
case kUmtxOpWait: {
|
||||||
return with_timeout(
|
return with_timeout(
|
||||||
[&](std::uint64_t ut) {
|
[&](std::uint64_t ut) {
|
||||||
return umtx_wait(thread, obj, val, ut, false, true);
|
return umtx_wait(thread, obj, val, ut, false, true);
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
case 3:
|
case kUmtxOpWake:
|
||||||
return umtx_wake(thread, obj, val);
|
return umtx_wake(thread, obj, val);
|
||||||
case 4:
|
case kUmtxOpMutexTrylock:
|
||||||
return umtx_trylock_umutex(thread, (ptr<umutex>)obj);
|
return umtx_trylock_umutex(thread, (ptr<umutex>)obj);
|
||||||
case 5: {
|
case kUmtxOpMutexLock: {
|
||||||
return with_timeout([&](std::uint64_t ut) {
|
return with_timeout([&](std::uint64_t ut) {
|
||||||
return umtx_lock_umutex(thread, (ptr<umutex>)obj, ut);
|
return umtx_lock_umutex(thread, (ptr<umutex>)obj, ut);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
case 6:
|
case kUmtxOpMutexUnock:
|
||||||
return umtx_unlock_umutex(thread, (ptr<umutex>)obj);
|
return umtx_unlock_umutex(thread, (ptr<umutex>)obj);
|
||||||
case 7:
|
case kUmtxOpSetCeiling:
|
||||||
return umtx_set_ceiling(thread, (ptr<umutex>)obj, val,
|
return umtx_set_ceiling(thread, (ptr<umutex>)obj, val,
|
||||||
(ptr<uint32_t>)uaddr1);
|
(ptr<uint32_t>)uaddr1);
|
||||||
|
case kUmtxOpCvWait: {
|
||||||
case 8: {
|
|
||||||
return with_timeout(
|
return with_timeout(
|
||||||
[&](std::uint64_t ut) {
|
[&](std::uint64_t ut) {
|
||||||
return umtx_cv_wait(thread, (ptr<ucond>)obj, (ptr<umutex>)uaddr1, ut,
|
return umtx_cv_wait(thread, (ptr<ucond>)obj, (ptr<umutex>)uaddr1, ut,
|
||||||
|
|
@ -121,55 +120,54 @@ orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
case kUmtxOpCvSignal:
|
||||||
case 9:
|
|
||||||
return umtx_cv_signal(thread, (ptr<ucond>)obj);
|
return umtx_cv_signal(thread, (ptr<ucond>)obj);
|
||||||
case 10:
|
case kUmtxOpCvBroadcast:
|
||||||
return umtx_cv_broadcast(thread, (ptr<ucond>)obj);
|
return umtx_cv_broadcast(thread, (ptr<ucond>)obj);
|
||||||
case 11: {
|
case kUmtxOpWaitUint: {
|
||||||
return with_timeout(
|
return with_timeout(
|
||||||
[&](std::uint64_t ut) {
|
[&](std::uint64_t ut) {
|
||||||
return umtx_wait(thread, obj, val, ut, true, true);
|
return umtx_wait(thread, obj, val, ut, true, true);
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
case 12:
|
case kUmtxOpRwRdLock:
|
||||||
return with_timeout([&](std::uint64_t ut) {
|
return with_timeout([&](std::uint64_t ut) {
|
||||||
return umtx_rw_rdlock(thread, (ptr<urwlock>)obj, val, ut);
|
return umtx_rw_rdlock(thread, (ptr<urwlock>)obj, val, ut);
|
||||||
});
|
});
|
||||||
case 13:
|
case kUmtxOpRwWrLock:
|
||||||
return with_timeout([&](std::uint64_t ut) {
|
return with_timeout([&](std::uint64_t ut) {
|
||||||
return umtx_rw_wrlock(thread, (ptr<urwlock>)obj, ut);
|
return umtx_rw_wrlock(thread, (ptr<urwlock>)obj, ut);
|
||||||
});
|
});
|
||||||
case 14:
|
case kUmtxOpRwUnlock:
|
||||||
return umtx_rw_unlock(thread, (ptr<urwlock>)obj);
|
return umtx_rw_unlock(thread, (ptr<urwlock>)obj);
|
||||||
case 15: {
|
case kUmtxOpWaitUintPrivate: {
|
||||||
return with_timeout(
|
return with_timeout(
|
||||||
[&](std::uint64_t ut) {
|
[&](std::uint64_t ut) {
|
||||||
return umtx_wait(thread, obj, val, ut, true, false);
|
return umtx_wait(thread, obj, val, ut, true, false);
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
case 16:
|
case kUmtxOpWakePrivate:
|
||||||
return umtx_wake_private(thread, obj, val);
|
return umtx_wake_private(thread, obj, val);
|
||||||
case 17: {
|
case kUmtxOpMutexWait: {
|
||||||
return with_timeout([&](std::uint64_t ut) {
|
return with_timeout([&](std::uint64_t ut) {
|
||||||
return umtx_wait_umutex(thread, (ptr<umutex>)obj, ut);
|
return umtx_wait_umutex(thread, (ptr<umutex>)obj, ut);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
case 18:
|
case kUmtxOpMutexWake:
|
||||||
return umtx_wake_umutex(thread, (ptr<umutex>)obj, 0);
|
return umtx_wake_umutex(thread, (ptr<umutex>)obj, 0);
|
||||||
case 19:
|
case kUmtxOpSemWait:
|
||||||
return with_timeout(
|
return with_timeout(
|
||||||
[&](std::uint64_t ut) {
|
[&](std::uint64_t ut) {
|
||||||
return umtx_sem_wait(thread, (ptr<usem>)obj, ut);
|
return umtx_sem_wait(thread, (ptr<usem>)obj, ut);
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
case 20:
|
case kUmtxOpSemWake:
|
||||||
return umtx_sem_wake(thread, (ptr<usem>)obj);
|
return umtx_sem_wake(thread, (ptr<usem>)obj);
|
||||||
case 21:
|
case kUmtxOpNwakePrivate:
|
||||||
return umtx_nwake_private(thread, (ptr<void *>)obj, val);
|
return umtx_nwake_private(thread, (ptr<void *>)obj, val);
|
||||||
case 22:
|
case kUmtxOpMutexWake2:
|
||||||
return umtx_wake2_umutex(thread, obj, val, uaddr1, uaddr2);
|
return umtx_wake2_umutex(thread, obj, val, uaddr1, uaddr2);
|
||||||
case 23:
|
case 23:
|
||||||
ORBIS_LOG_ERROR("sys__umtx_op: unknown wake operation", op, val, uaddr1, uaddr2);
|
ORBIS_LOG_ERROR("sys__umtx_op: unknown wake operation", op, val, uaddr1, uaddr2);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue