From d0d22529f9ca23f86bc388830ae99c7ab996dfe4 Mon Sep 17 00:00:00 2001 From: DH Date: Sat, 31 Aug 2024 23:55:47 +0300 Subject: [PATCH] iodev: add kayman/reg device stub --- rpcsx-os/CMakeLists.txt | 1 + rpcsx-os/io-devices.hpp | 1 + rpcsx-os/iodev/cayman_reg.cpp | 39 +++++++++++++++++++++++++++++++++++ rpcsx-os/main.cpp | 1 + 4 files changed, 42 insertions(+) create mode 100644 rpcsx-os/iodev/cayman_reg.cpp diff --git a/rpcsx-os/CMakeLists.txt b/rpcsx-os/CMakeLists.txt index d9ecd0b6a..47e382cde 100644 --- a/rpcsx-os/CMakeLists.txt +++ b/rpcsx-os/CMakeLists.txt @@ -48,6 +48,7 @@ add_executable(rpcsx-os iodev/sshot.cpp iodev/lvdctl.cpp iodev/icc_power.cpp + iodev/cayman_reg.cpp main.cpp backtrace.cpp diff --git a/rpcsx-os/io-devices.hpp b/rpcsx-os/io-devices.hpp index 76319ff9f..b10045a87 100644 --- a/rpcsx-os/io-devices.hpp +++ b/rpcsx-os/io-devices.hpp @@ -48,3 +48,4 @@ IoDevice *createSrtcCharacterDevice(); IoDevice *createScreenShotCharacterDevice(); IoDevice *createLvdCtlCharacterDevice(); IoDevice *createIccPowerCharacterDevice(); +IoDevice *createCaymanRegCharacterDevice(); diff --git a/rpcsx-os/iodev/cayman_reg.cpp b/rpcsx-os/iodev/cayman_reg.cpp new file mode 100644 index 000000000..d8bca864a --- /dev/null +++ b/rpcsx-os/iodev/cayman_reg.cpp @@ -0,0 +1,39 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/thread/Thread.hpp" +#include "orbis/utils/Logs.hpp" + +struct CaymanRegDevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override; +}; + +static orbis::ErrorCode cayman_reg_ioctl(orbis::File *file, + std::uint64_t request, void *argp, + orbis::Thread *thread) { + ORBIS_LOG_FATAL("Unhandled cayman_reg ioctl", request); + thread->where(); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = cayman_reg_ioctl, +}; + +orbis::ErrorCode CaymanRegDevice::open(orbis::Ref *file, + const char *path, std::uint32_t flags, + std::uint32_t mode, + orbis::Thread *thread) { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; +} + +IoDevice *createCaymanRegCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx-os/main.cpp b/rpcsx-os/main.cpp index 3b36f872e..7143a68b7 100644 --- a/rpcsx-os/main.cpp +++ b/rpcsx-os/main.cpp @@ -474,6 +474,7 @@ static void ps4InitDev() { rx::vfs::addDevice("lvdctl", createLvdCtlCharacterDevice()); rx::vfs::addDevice("lvd0", createHddCharacterDevice(0x100000000)); rx::vfs::addDevice("icc_power", createIccPowerCharacterDevice()); + rx::vfs::addDevice("cayman/reg", createCaymanRegCharacterDevice()); // mbus->emitEvent({ // .system = 2,