From 35ba07f676af599225d42a392edd628c1c2c548e Mon Sep 17 00:00:00 2001 From: DH Date: Sun, 3 Sep 2023 22:22:20 +0300 Subject: [PATCH] [rpcsx-os] stub console, npdrm and icc_configuration devices --- rpcsx-os/CMakeLists.txt | 3 +++ rpcsx-os/io-devices.hpp | 3 +++ rpcsx-os/iodev/console.cpp | 32 ++++++++++++++++++++++++++++ rpcsx-os/iodev/icc_configuration.cpp | 32 ++++++++++++++++++++++++++++ rpcsx-os/iodev/npdrm.cpp | 32 ++++++++++++++++++++++++++++ rpcsx-os/main.cpp | 3 +++ 6 files changed, 105 insertions(+) create mode 100644 rpcsx-os/iodev/console.cpp create mode 100644 rpcsx-os/iodev/icc_configuration.cpp create mode 100644 rpcsx-os/iodev/npdrm.cpp diff --git a/rpcsx-os/CMakeLists.txt b/rpcsx-os/CMakeLists.txt index a79f94f92..25c7c0301 100644 --- a/rpcsx-os/CMakeLists.txt +++ b/rpcsx-os/CMakeLists.txt @@ -5,6 +5,7 @@ add_library(orbis::kernel::config ALIAS standalone-config) add_executable(rpcsx-os iodev/ajm.cpp iodev/blockpool.cpp + iodev/console.cpp iodev/dce.cpp iodev/dipsw.cpp iodev/dmem.cpp @@ -14,6 +15,8 @@ add_executable(rpcsx-os iodev/hmd_cmd.cpp iodev/hmd_mmap.cpp iodev/hmd_snsr.cpp + iodev/icc_configuration.cpp + iodev/npdrm.cpp iodev/null.cpp iodev/rng.cpp iodev/sbl_srv.cpp diff --git a/rpcsx-os/io-devices.hpp b/rpcsx-os/io-devices.hpp index 437d0b1f1..79e3f5d40 100644 --- a/rpcsx-os/io-devices.hpp +++ b/rpcsx-os/io-devices.hpp @@ -15,6 +15,9 @@ IoDevice *createNullCharacterDevice(); IoDevice *createZeroCharacterDevice(); IoDevice *createRngCharacterDevice(); IoDevice *createAjmCharacterDevice(); +IoDevice *createIccConfigurationCharacterDevice(); +IoDevice *createNpdrmCharacterDevice(); +IoDevice *createConsoleCharacterDevice(); IoDevice *createSblSrvCharacterDevice(); IoDevice *createShmDevice(); IoDevice *createBlockPoolDevice(); diff --git a/rpcsx-os/iodev/console.cpp b/rpcsx-os/iodev/console.cpp new file mode 100644 index 000000000..ca1f28043 --- /dev/null +++ b/rpcsx-os/iodev/console.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" + +struct ConsoleFile : orbis::File {}; + +static orbis::ErrorCode console_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + ORBIS_LOG_FATAL("Unhandled console ioctl", request); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = console_ioctl, +}; + +struct ConsoleDevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; + } +}; + +IoDevice *createConsoleCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx-os/iodev/icc_configuration.cpp b/rpcsx-os/iodev/icc_configuration.cpp new file mode 100644 index 000000000..fcdab8503 --- /dev/null +++ b/rpcsx-os/iodev/icc_configuration.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" + +struct IccConfigurationFile : orbis::File {}; + +static orbis::ErrorCode icc_configuration_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + ORBIS_LOG_FATAL("Unhandled icc_configuration ioctl", request); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = icc_configuration_ioctl, +}; + +struct IccConfigurationDevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; + } +}; + +IoDevice *createIccConfigurationCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx-os/iodev/npdrm.cpp b/rpcsx-os/iodev/npdrm.cpp new file mode 100644 index 000000000..0da9e2885 --- /dev/null +++ b/rpcsx-os/iodev/npdrm.cpp @@ -0,0 +1,32 @@ +#include "io-device.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" +#include "orbis/utils/Logs.hpp" + +struct NpdrmFile : orbis::File {}; + +static orbis::ErrorCode npdrm_ioctl(orbis::File *file, std::uint64_t request, + void *argp, orbis::Thread *thread) { + + ORBIS_LOG_FATAL("Unhandled NPDRM ioctl", request); + return {}; +} + +static const orbis::FileOps fileOps = { + .ioctl = npdrm_ioctl, +}; + +struct NpdrmDevice : IoDevice { + orbis::ErrorCode open(orbis::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + orbis::Thread *thread) override { + auto newFile = orbis::knew(); + newFile->ops = &fileOps; + newFile->device = this; + + *file = newFile; + return {}; + } +}; + +IoDevice *createNpdrmCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx-os/main.cpp b/rpcsx-os/main.cpp index 2df55c9ac..004019543 100644 --- a/rpcsx-os/main.cpp +++ b/rpcsx-os/main.cpp @@ -323,6 +323,9 @@ static int ps4Exec(orbis::Thread *mainThread, orbis::g_context.dmemDevice = dmem1; rx::vfs::mount("/dev/dmem0", createDmemCharacterDevice(0)); + rx::vfs::mount("/dev/npdrm", createNpdrmCharacterDevice()); + rx::vfs::mount("/dev/icc_configuration", createIccConfigurationCharacterDevice()); + rx::vfs::mount("/dev/console", createConsoleCharacterDevice()); rx::vfs::mount("/dev/dmem1", dmem1); rx::vfs::mount("/dev/dmem2", createDmemCharacterDevice(2)); rx::vfs::mount("/dev/stdout", createFdWrapDevice(STDOUT_FILENO));