mirror of
https://github.com/RPCSX/rpcsx.git
synced 2024-11-23 03:19:47 +00:00
[orbis-kernel] impi: implement server ops
stub mkdir/rmdir syscalls
This commit is contained in:
parent
ca58c03eb6
commit
7ea6f3d91a
@ -106,10 +106,7 @@ public:
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<IpmiServer *, bool> createIpmiServer(utils::kstring name,
|
std::pair<IpmiServer *, bool> createIpmiServer(utils::kstring name) {
|
||||||
std::uint32_t attrs,
|
|
||||||
std::int32_t initCount,
|
|
||||||
std::int32_t maxCount) {
|
|
||||||
std::lock_guard lock(m_sem_mtx);
|
std::lock_guard lock(m_sem_mtx);
|
||||||
auto [it, inserted] = mIpmiServers.try_emplace(std::move(name), nullptr);
|
auto [it, inserted] = mIpmiServers.try_emplace(std::move(name), nullptr);
|
||||||
if (inserted) {
|
if (inserted) {
|
||||||
|
@ -30,6 +30,8 @@ struct FileOps {
|
|||||||
|
|
||||||
ErrorCode (*stat)(File *file, Stat *sb, Thread *thread) = nullptr;
|
ErrorCode (*stat)(File *file, Stat *sb, Thread *thread) = nullptr;
|
||||||
|
|
||||||
|
ErrorCode (*mkdir)(File *file, const char *path, std::int32_t mode) = nullptr;
|
||||||
|
|
||||||
// TODO: chown
|
// TODO: chown
|
||||||
// TODO: chmod
|
// TODO: chmod
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ struct Process final {
|
|||||||
utils::RcIdMap<EventFlag, sint, 4097, 1> evfMap;
|
utils::RcIdMap<EventFlag, sint, 4097, 1> evfMap;
|
||||||
utils::RcIdMap<Semaphore, sint, 4097, 1> semMap;
|
utils::RcIdMap<Semaphore, sint, 4097, 1> semMap;
|
||||||
utils::RcIdMap<IpmiClient, sint, 4097, 1> ipmiClientMap;
|
utils::RcIdMap<IpmiClient, sint, 4097, 1> ipmiClientMap;
|
||||||
|
utils::RcIdMap<IpmiServer, sint, 4097, 1> ipmiServerMap;
|
||||||
utils::RcIdMap<Module, ModuleHandle> modulesMap;
|
utils::RcIdMap<Module, ModuleHandle> modulesMap;
|
||||||
utils::OwningIdMap<Thread, lwpid_t> threadsMap;
|
utils::OwningIdMap<Thread, lwpid_t> threadsMap;
|
||||||
utils::RcIdMap<orbis::File, sint> fileDescriptors;
|
utils::RcIdMap<orbis::File, sint> fileDescriptors;
|
||||||
|
@ -40,6 +40,8 @@ struct ProcessOps {
|
|||||||
Ref<File> *file);
|
Ref<File> *file);
|
||||||
SysResult (*shm_open)(Thread *thread, const char *path, sint flags, sint mode,
|
SysResult (*shm_open)(Thread *thread, const char *path, sint flags, sint mode,
|
||||||
Ref<File> *file);
|
Ref<File> *file);
|
||||||
|
SysResult (*mkdir)(Thread *thread, ptr<const char> path, sint mode);
|
||||||
|
SysResult (*rmdir)(Thread *thread, ptr<const char> path) = nullptr;
|
||||||
SysResult (*blockpool_open)(Thread *thread, Ref<File> *file);
|
SysResult (*blockpool_open)(Thread *thread, Ref<File> *file);
|
||||||
SysResult (*blockpool_map)(Thread *thread, caddr_t addr, size_t len,
|
SysResult (*blockpool_map)(Thread *thread, caddr_t addr, size_t len,
|
||||||
sint prot, sint flags);
|
sint prot, sint flags);
|
||||||
|
@ -977,6 +977,19 @@ struct IpmiSyncCallParams {
|
|||||||
orbis::uint32_t resultCount;
|
orbis::uint32_t resultCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct IpmiCreateServerParams {
|
||||||
|
orbis::uint64_t arg0;
|
||||||
|
orbis::ptr<char> name;
|
||||||
|
orbis::uint64_t arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IpmiClientConnectParams {
|
||||||
|
orbis::ptr<char> arg0;
|
||||||
|
orbis::ptr<char> name;
|
||||||
|
orbis::ptr<char> arg2;
|
||||||
|
orbis::ptr<char> arg3;
|
||||||
|
};
|
||||||
|
|
||||||
static_assert(sizeof(IpmiSyncCallParams) == 0x30);
|
static_assert(sizeof(IpmiSyncCallParams) == 0x30);
|
||||||
|
|
||||||
orbis::SysResult orbis::sys_ipmimgr_call(Thread *thread, uint op, uint kid,
|
orbis::SysResult orbis::sys_ipmimgr_call(Thread *thread, uint op, uint kid,
|
||||||
@ -985,6 +998,36 @@ orbis::SysResult orbis::sys_ipmimgr_call(Thread *thread, uint op, uint kid,
|
|||||||
ORBIS_LOG_TODO("sys_ipmimgr_call", op, kid, result, params, paramsSz, arg6);
|
ORBIS_LOG_TODO("sys_ipmimgr_call", op, kid, result, params, paramsSz, arg6);
|
||||||
thread->where();
|
thread->where();
|
||||||
|
|
||||||
|
if (op == kImpiCreateServer) {
|
||||||
|
if (paramsSz != sizeof(IpmiCreateServerParams)) {
|
||||||
|
return ErrorCode::INVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto createParams = (ptr<IpmiCreateServerParams>)params;
|
||||||
|
|
||||||
|
ORBIS_LOG_TODO("IPMI: create server", createParams->arg0,
|
||||||
|
createParams->name, createParams->arg2);
|
||||||
|
|
||||||
|
auto [server, inserted] = g_context.createIpmiServer(createParams->name);
|
||||||
|
if (!inserted) {
|
||||||
|
return ErrorCode::EXIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto id = thread->tproc->ipmiServerMap.insert(server);
|
||||||
|
return uwrite<uint>(result, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (op == 0x10) {
|
||||||
|
// IPMI server start?
|
||||||
|
|
||||||
|
return uwrite<uint>(result, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (op == 0x201) {
|
||||||
|
// IPMI server receive packet?
|
||||||
|
return uwrite<uint>(result, 0x80020023);
|
||||||
|
}
|
||||||
|
|
||||||
if (op == kIpmiCreateClient) {
|
if (op == kIpmiCreateClient) {
|
||||||
if (paramsSz != sizeof(IpmiCreateClientParams)) {
|
if (paramsSz != sizeof(IpmiCreateClientParams)) {
|
||||||
return ErrorCode::INVAL;
|
return ErrorCode::INVAL;
|
||||||
@ -1029,7 +1072,13 @@ orbis::SysResult orbis::sys_ipmimgr_call(Thread *thread, uint op, uint kid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (op == 0x400) {
|
if (op == 0x400) {
|
||||||
ORBIS_LOG_TODO("IMPI: connect?");
|
if (paramsSz != sizeof(IpmiClientConnectParams)) {
|
||||||
|
return ErrorCode::INVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto connectParams = (ptr<IpmiClientConnectParams>)params;
|
||||||
|
ORBIS_LOG_TODO("IMPI: connect?", connectParams->arg0, connectParams->name,
|
||||||
|
connectParams->arg2, connectParams->arg3);
|
||||||
if (result) {
|
if (result) {
|
||||||
return uwrite<uint>(result, 0);
|
return uwrite<uint>(result, 0);
|
||||||
}
|
}
|
||||||
|
@ -292,13 +292,32 @@ orbis::SysResult orbis::sys_renameat(Thread *thread, sint oldfd, ptr<char> old,
|
|||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_mkdir(Thread *thread, ptr<char> path, sint mode) {
|
orbis::SysResult orbis::sys_mkdir(Thread *thread, ptr<char> path, sint mode) {
|
||||||
|
if (auto mkdir = thread->tproc->ops->mkdir) {
|
||||||
|
return mkdir(thread, path, mode);
|
||||||
|
}
|
||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_mkdirat(Thread *thread, sint fd, ptr<char> path,
|
orbis::SysResult orbis::sys_mkdirat(Thread *thread, sint fd, ptr<char> path,
|
||||||
mode_t mode) {
|
mode_t mode) {
|
||||||
return ErrorCode::NOSYS;
|
Ref<File> file = thread->tproc->fileDescriptors.get(fd);
|
||||||
|
if (file == nullptr) {
|
||||||
|
return ErrorCode::BADF;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto mkdir = file->ops->mkdir;
|
||||||
|
|
||||||
|
if (mkdir == nullptr) {
|
||||||
|
return ErrorCode::NOTSUP;
|
||||||
|
}
|
||||||
|
std::lock_guard lock(file->mtx);
|
||||||
|
|
||||||
|
return mkdir(file.get(), path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
orbis::SysResult orbis::sys_rmdir(Thread *thread, ptr<char> path) {
|
orbis::SysResult orbis::sys_rmdir(Thread *thread, ptr<char> path) {
|
||||||
|
if (auto rmdir = thread->tproc->ops->rmdir) {
|
||||||
|
return rmdir(thread, path);
|
||||||
|
}
|
||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_getdirentries(Thread *thread, sint fd,
|
orbis::SysResult orbis::sys_getdirentries(Thread *thread, sint fd,
|
||||||
|
Loading…
Reference in New Issue
Block a user