[rpcsx-os] implement blockpool device

This commit is contained in:
DH 2023-07-30 14:56:25 +03:00
parent e967c8cf80
commit 89db63ca46
10 changed files with 203 additions and 6 deletions

View file

@ -149,6 +149,7 @@ public:
Ref<RcBase> shmDevice;
Ref<RcBase> dmemDevice;
Ref<RcBase> blockpoolDevice;
private:
mutable pthread_mutex_t m_heap_mtx;

View file

@ -759,9 +759,11 @@ SysResult sys_dynlib_get_obj_member(Thread *thread, SceKernelModule handle,
SysResult sys_budget_get_ptype_of_budget(Thread *thread /* TODO */);
SysResult sys_prepare_to_resume_process(Thread *thread /* TODO */);
SysResult sys_process_terminate(Thread *thread /* TODO */);
SysResult sys_blockpool_open(Thread *thread /* TODO */);
SysResult sys_blockpool_map(Thread *thread /* TODO */);
SysResult sys_blockpool_unmap(Thread *thread /* TODO */);
SysResult sys_blockpool_open(Thread *thread);
SysResult sys_blockpool_map(Thread *thread, caddr_t addr, size_t len, sint prot,
sint flags);
SysResult sys_blockpool_unmap(Thread *thread, caddr_t addr, size_t len,
sint flags);
SysResult sys_dynlib_get_info_for_libdbg(Thread *thread /* TODO */);
SysResult sys_blockpool_batch(Thread *thread /* TODO */);
SysResult sys_fdatasync(Thread *thread /* TODO */);

View file

@ -37,6 +37,10 @@ struct ProcessOps {
Ref<File> *file);
SysResult (*shm_open)(Thread *thread, const char *path, sint flags, sint mode,
Ref<File> *file);
SysResult (*blockpool_open)(Thread *thread, Ref<File> *file);
SysResult (*blockpool_map)(Thread *thread, caddr_t addr, size_t len,
sint prot, sint flags);
SysResult (*blockpool_unmap)(Thread *thread, caddr_t addr, size_t len);
SysResult (*socket)(Thread *thread, ptr<const char> name, sint domain,
sint type, sint protocol, Ref<File> *file);
SysResult (*shm_unlink)(Thread *thread, const char *path);

View file

@ -1217,13 +1217,31 @@ orbis::sys_prepare_to_resume_process(Thread *thread /* TODO */) {
orbis::SysResult orbis::sys_process_terminate(Thread *thread /* TODO */) {
return ErrorCode::NOSYS;
}
orbis::SysResult orbis::sys_blockpool_open(Thread *thread /* TODO */) {
orbis::SysResult orbis::sys_blockpool_open(Thread *thread) {
if (auto blockpool_open = thread->tproc->ops->blockpool_open) {
Ref<File> file;
auto result = blockpool_open(thread, &file);
if (result.isError()) {
return result;
}
thread->retval[0] = thread->tproc->fileDescriptors.insert(file);
return {};
}
return ErrorCode::NOSYS;
}
orbis::SysResult orbis::sys_blockpool_map(Thread *thread /* TODO */) {
orbis::SysResult orbis::sys_blockpool_map(Thread *thread, caddr_t addr,
size_t len, sint prot, sint flags) {
if (auto blockpool_map = thread->tproc->ops->blockpool_map) {
return blockpool_map(thread, addr, len, prot, flags);
}
return ErrorCode::NOSYS;
}
orbis::SysResult orbis::sys_blockpool_unmap(Thread *thread /* TODO */) {
orbis::SysResult orbis::sys_blockpool_unmap(Thread *thread, caddr_t addr,
size_t len, sint flags) {
if (auto blockpool_unmap = thread->tproc->ops->blockpool_unmap) {
return blockpool_unmap(thread, addr, len);
}
return ErrorCode::NOSYS;
}
orbis::SysResult