mirror of
https://github.com/RPCSX/rpcsx.git
synced 2024-12-12 13:26:43 +00:00
[orbis-kernel] umtx: initial template
This commit is contained in:
parent
4d783245ad
commit
6d3dc8d645
@ -5,6 +5,7 @@ add_library(obj.orbis-kernel OBJECT
|
||||
src/sysvec.cpp
|
||||
src/evf.cpp
|
||||
src/KernelContext.cpp
|
||||
src/umtx.cpp
|
||||
src/sys/sys_acct.cpp
|
||||
src/sys/sys_audit.cpp
|
||||
src/sys/sys_capability.cpp
|
||||
|
31
orbis-kernel/include/orbis/umtx.hpp
Normal file
31
orbis-kernel/include/orbis/umtx.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "error/ErrorCode.hpp"
|
||||
#include "orbis-config.hpp"
|
||||
|
||||
namespace orbis {
|
||||
struct Thread;
|
||||
ErrorCode umtx_lock_umtx(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_unlock_umtx(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_wait(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_wake(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_trylock_umutex(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_lock_umutex(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_unlock_umutex(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_set_ceiling(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_cv_wait(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_cv_signal(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_cv_broadcast(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_wait_uint(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_rw_rdlock(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_rw_wrlock(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_rw_unlock(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_wait_uint_private(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_wake_private(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_wait_umutex(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_wake_umutex(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
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> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
ErrorCode umtx_wake2_umutex(Thread *thread, ptr<void> obj, std::int64_t val, ptr<void> uaddr1, ptr<void> uaddr2);
|
||||
}
|
@ -1,15 +1,64 @@
|
||||
#include "sys/sysproto.hpp"
|
||||
#include "umtx.hpp"
|
||||
|
||||
orbis::SysResult orbis::sys__umtx_lock(Thread *thread, ptr<struct umtx> umtx) {
|
||||
return ErrorCode::NOSYS;
|
||||
return umtx_lock_umtx(thread, umtx, 0, 0, 0);
|
||||
}
|
||||
orbis::SysResult orbis::sys__umtx_unlock(Thread *thread,
|
||||
ptr<struct umtx> umtx) {
|
||||
return ErrorCode::NOSYS;
|
||||
return umtx_lock_umtx(thread, umtx, thread->tid, 0, 0);
|
||||
}
|
||||
orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
|
||||
ulong val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
std::printf("TODO: sys__umtx_op\n");
|
||||
return {};
|
||||
switch (op) {
|
||||
case 0:
|
||||
return umtx_lock_umtx(thread, obj, val, uaddr1, uaddr2);
|
||||
case 1:
|
||||
return umtx_unlock_umtx(thread, obj, val, uaddr1, uaddr2);
|
||||
case 2:
|
||||
return umtx_wait(thread, obj, val, uaddr1, uaddr2);
|
||||
case 3:
|
||||
return umtx_wake(thread, obj, val, uaddr1, uaddr2);
|
||||
case 4:
|
||||
return umtx_trylock_umutex(thread, obj, val, uaddr1, uaddr2);
|
||||
case 5:
|
||||
return umtx_lock_umutex(thread, obj, val, uaddr1, uaddr2);
|
||||
case 6:
|
||||
return umtx_unlock_umutex(thread, obj, val, uaddr1, uaddr2);
|
||||
case 7:
|
||||
return umtx_set_ceiling(thread, obj, val, uaddr1, uaddr2);
|
||||
case 8:
|
||||
return umtx_cv_wait(thread, obj, val, uaddr1, uaddr2);
|
||||
case 9:
|
||||
return umtx_cv_signal(thread, obj, val, uaddr1, uaddr2);
|
||||
case 10:
|
||||
return umtx_cv_broadcast(thread, obj, val, uaddr1, uaddr2);
|
||||
case 11:
|
||||
return umtx_wait_uint(thread, obj, val, uaddr1, uaddr2);
|
||||
case 12:
|
||||
return umtx_rw_rdlock(thread, obj, val, uaddr1, uaddr2);
|
||||
case 13:
|
||||
return umtx_rw_wrlock(thread, obj, val, uaddr1, uaddr2);
|
||||
case 14:
|
||||
return umtx_rw_unlock(thread, obj, val, uaddr1, uaddr2);
|
||||
case 15:
|
||||
return umtx_wait_uint_private(thread, obj, val, uaddr1, uaddr2);
|
||||
case 16:
|
||||
return umtx_wake_private(thread, obj, val, uaddr1, uaddr2);
|
||||
case 17:
|
||||
return umtx_wait_umutex(thread, obj, val, uaddr1, uaddr2);
|
||||
case 18:
|
||||
return umtx_wake_umutex(thread, obj, val, uaddr1, uaddr2);
|
||||
case 19:
|
||||
return umtx_sem_wait(thread, obj, val, uaddr1, uaddr2);
|
||||
case 20:
|
||||
return umtx_sem_wake(thread, obj, val, uaddr1, uaddr2);
|
||||
case 21:
|
||||
return umtx_nwake_private(thread, obj, val, uaddr1, uaddr2);
|
||||
case 22:
|
||||
return umtx_wake2_umutex(thread, obj, val, uaddr1, uaddr2);
|
||||
}
|
||||
|
||||
return ErrorCode::INVAL;
|
||||
}
|
||||
|
140
orbis-kernel/src/umtx.cpp
Normal file
140
orbis-kernel/src/umtx.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
#include "umtx.hpp"
|
||||
|
||||
orbis::ErrorCode orbis::umtx_lock_umtx(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_unlock_umtx(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wait(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wake(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_trylock_umutex(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_lock_umutex(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_unlock_umutex(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_set_ceiling(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_cv_wait(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_cv_signal(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_cv_broadcast(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wait_uint(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_rw_rdlock(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_rw_wrlock(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_rw_unlock(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wait_uint_private(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val,
|
||||
ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wake_private(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wait_umutex(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wake_umutex(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_sem_wait(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_sem_wake(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_nwake_private(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
|
||||
orbis::ErrorCode orbis::umtx_wake2_umutex(Thread *thread, ptr<void> obj,
|
||||
std::int64_t val, ptr<void> uaddr1,
|
||||
ptr<void> uaddr2) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user