rpcsx/rpcsx-os/iodev/gbase.cpp
DH 65e653f5ef [rpcsx-os/orbis-kernel] random bugfixes
ipmi: fixed respond sync, get message, try get message, try send message
event: detach event emitter from file
signals: basic implementation
linker: fixed zero symbol relocation, fixed exec relocation
shared_cv/mutex: implement eintr response support
shared_cv: fixed possible loop instead of wait
ipmi: implement invoke async, respond async, get result, get client app id, client get name
rpcsx-os: add safemode flag
2024-01-13 20:57:02 +03:00

53 lines
1.3 KiB
C++

#include "io-device.hpp"
#include "orbis/KernelAllocator.hpp"
#include "orbis/file.hpp"
#include "orbis/utils/Logs.hpp"
#include "orbis/thread/Thread.hpp"
struct GbaseFile : orbis::File {};
static orbis::ErrorCode gbase_ioctl(orbis::File *file, std::uint64_t request,
void *argp, orbis::Thread *thread) {
if (request == 0xc0304510) {
ORBIS_LOG_WARNING("gbase ioctl", request);
struct Args {
std::uint64_t unk0;
std::uint64_t unk1;
std::uint32_t currentClock;
std::uint32_t unk2;
std::uint64_t unk3;
std::uint64_t unk4;
std::uint64_t unk5;
};
static_assert(sizeof(Args) == 48);
*reinterpret_cast<Args *>(argp) = {
.currentClock = 1,
};
return{};
}
ORBIS_LOG_FATAL("Unhandled gbase ioctl", request);
thread->where();
return {};
}
static const orbis::FileOps fileOps = {
.ioctl = gbase_ioctl,
};
struct GbaseDevice : IoDevice {
orbis::ErrorCode open(orbis::Ref<orbis::File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
orbis::Thread *thread) override {
auto newFile = orbis::knew<GbaseFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createGbaseCharacterDevice() { return orbis::knew<GbaseDevice>(); }