mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 14:37:08 +00:00
[orbis-kernel] Stub umtx ipc support
This commit is contained in:
parent
6c7bde4faa
commit
773be7283d
5 changed files with 55 additions and 30 deletions
|
|
@ -19,8 +19,8 @@ struct Thread;
|
|||
|
||||
struct UmtxKey {
|
||||
// TODO: may contain a reference to a shared memory
|
||||
void *addr;
|
||||
pid_t pid;
|
||||
std::uintptr_t addr;
|
||||
orbis::pid_t pid;
|
||||
|
||||
auto operator<=>(const UmtxKey &) const = default;
|
||||
};
|
||||
|
|
@ -112,21 +112,16 @@ public:
|
|||
|
||||
// Use getUmtxChain0 or getUmtxChain1
|
||||
std::tuple<UmtxChain &, UmtxKey, std::unique_lock<shared_mutex>>
|
||||
getUmtxChainIndexed(int i, pid_t pid, void *ptr) {
|
||||
auto n = reinterpret_cast<std::uintptr_t>(ptr) + pid;
|
||||
n = ((n * c_golden_ratio_prime) >> c_umtx_shifts) % c_umtx_chains;
|
||||
std::unique_lock lock(m_umtx_chains[i][n].mtx);
|
||||
return {m_umtx_chains[i][n], UmtxKey{ptr, pid}, std::move(lock)};
|
||||
}
|
||||
getUmtxChainIndexed(int i, Thread *t, uint32_t flags, void *ptr);
|
||||
|
||||
// Internal Umtx: Wait/Cv/Sem
|
||||
auto getUmtxChain0(pid_t pid, void *ptr) {
|
||||
return getUmtxChainIndexed(0, pid, ptr);
|
||||
auto getUmtxChain0(Thread *t, uint32_t flags, void *ptr) {
|
||||
return getUmtxChainIndexed(0, t, flags, ptr);
|
||||
}
|
||||
|
||||
// Internal Umtx: Mutex/Umtx/Rwlock
|
||||
auto getUmtxChain1(pid_t pid, void *ptr) {
|
||||
return getUmtxChainIndexed(1, pid, ptr);
|
||||
auto getUmtxChain1(Thread *t, uint32_t flags, void *ptr) {
|
||||
return getUmtxChainIndexed(1, t, flags, ptr);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ ErrorCode umtx_lock_umtx(Thread *thread, ptr<umtx> umtx, ulong id,
|
|||
std::uint64_t ut);
|
||||
ErrorCode umtx_unlock_umtx(Thread *thread, ptr<umtx> umtx, ulong id);
|
||||
ErrorCode umtx_wait(Thread *thread, ptr<void> addr, ulong id, std::uint64_t ut,
|
||||
bool is32);
|
||||
bool is32, bool ipc);
|
||||
ErrorCode umtx_wake(Thread *thread, ptr<void> addr, sint n_wake);
|
||||
ErrorCode umtx_trylock_umutex(Thread *thread, ptr<umutex> m);
|
||||
ErrorCode umtx_lock_umutex(Thread *thread, ptr<umutex> m, std::uint64_t ut);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue