[rpcsx-os] stub console, npdrm and icc_configuration devices

This commit is contained in:
DH 2023-09-03 22:22:20 +03:00
parent 738a760fbe
commit 35ba07f676
6 changed files with 105 additions and 0 deletions

View file

@ -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

View file

@ -15,6 +15,9 @@ IoDevice *createNullCharacterDevice();
IoDevice *createZeroCharacterDevice();
IoDevice *createRngCharacterDevice();
IoDevice *createAjmCharacterDevice();
IoDevice *createIccConfigurationCharacterDevice();
IoDevice *createNpdrmCharacterDevice();
IoDevice *createConsoleCharacterDevice();
IoDevice *createSblSrvCharacterDevice();
IoDevice *createShmDevice();
IoDevice *createBlockPoolDevice();

View file

@ -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<orbis::File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
orbis::Thread *thread) override {
auto newFile = orbis::knew<ConsoleFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createConsoleCharacterDevice() { return orbis::knew<ConsoleDevice>(); }

View file

@ -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<orbis::File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
orbis::Thread *thread) override {
auto newFile = orbis::knew<IccConfigurationFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createIccConfigurationCharacterDevice() { return orbis::knew<IccConfigurationDevice>(); }

32
rpcsx-os/iodev/npdrm.cpp Normal file
View file

@ -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<orbis::File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
orbis::Thread *thread) override {
auto newFile = orbis::knew<NpdrmFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createNpdrmCharacterDevice() { return orbis::knew<NpdrmDevice>(); }

View file

@ -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));