[rpcsx-os] stub aout, av_control, hdmi, mbus_av, scanin devices

This commit is contained in:
DH 2023-11-03 22:41:32 +03:00
parent 7eeeaf1d2d
commit a9d385d424
9 changed files with 177 additions and 2 deletions

View file

@ -31,6 +31,11 @@ add_executable(rpcsx-os
iodev/urandom.cpp
iodev/xpt.cpp
iodev/zero.cpp
iodev/aout.cpp
iodev/av_control.cpp
iodev/hdmi.cpp
iodev/mbus_av.cpp
iodev/scanin.cpp
main.cpp
backtrace.cpp

View file

@ -30,3 +30,8 @@ IoDevice *createXptCharacterDevice();
IoDevice *createCdCharacterDevice();
IoDevice *createMetaDbgCharacterDevice();
IoDevice *createHddCharacterDevice();
IoDevice *createAoutCharacterDevice();
IoDevice *createAVControlCharacterDevice();
IoDevice *createHDMICharacterDevice();
IoDevice *createMBusAVCharacterDevice();
IoDevice *createScaninCharacterDevice();

32
rpcsx-os/iodev/aout.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 AoutFile : orbis::File {};
static orbis::ErrorCode aout_ioctl(orbis::File *file, std::uint64_t request,
void *argp, orbis::Thread *thread) {
ORBIS_LOG_FATAL("Unhandled aout ioctl", request);
return {};
}
static const orbis::FileOps fileOps = {
.ioctl = aout_ioctl,
};
struct AoutDevice : 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<AoutFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createAoutCharacterDevice() { return orbis::knew<AoutDevice>(); }

View file

@ -0,0 +1,32 @@
#include "io-device.hpp"
#include "orbis/KernelAllocator.hpp"
#include "orbis/file.hpp"
#include "orbis/utils/Logs.hpp"
struct AVControlFile : orbis::File {};
static orbis::ErrorCode av_control_ioctl(orbis::File *file, std::uint64_t request,
void *argp, orbis::Thread *thread) {
ORBIS_LOG_FATAL("Unhandled av_control ioctl", request);
return {};
}
static const orbis::FileOps fileOps = {
.ioctl = av_control_ioctl,
};
struct AVControlDevice : 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<AVControlFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createAVControlCharacterDevice() { return orbis::knew<AVControlDevice>(); }

32
rpcsx-os/iodev/hdmi.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 HDMIFile : orbis::File {};
static orbis::ErrorCode hdmi_ioctl(orbis::File *file, std::uint64_t request,
void *argp, orbis::Thread *thread) {
ORBIS_LOG_FATAL("Unhandled hdmi ioctl", request);
return {};
}
static const orbis::FileOps fileOps = {
.ioctl = hdmi_ioctl,
};
struct HDMIDevice : 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<HDMIFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createHDMICharacterDevice() { return orbis::knew<HDMIDevice>(); }

View file

@ -0,0 +1,32 @@
#include "io-device.hpp"
#include "orbis/KernelAllocator.hpp"
#include "orbis/file.hpp"
#include "orbis/utils/Logs.hpp"
struct MBusAVFile : orbis::File {};
static orbis::ErrorCode mbus_av_ioctl(orbis::File *file, std::uint64_t request,
void *argp, orbis::Thread *thread) {
ORBIS_LOG_FATAL("Unhandled mbus_av ioctl", request);
return {};
}
static const orbis::FileOps fileOps = {
.ioctl = mbus_av_ioctl,
};
struct MBusAVDevice : 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<MBusAVFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createMBusAVCharacterDevice() { return orbis::knew<MBusAVDevice>(); }

32
rpcsx-os/iodev/scanin.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 ScaninFile : orbis::File {};
static orbis::ErrorCode scanin_ioctl(orbis::File *file, std::uint64_t request,
void *argp, orbis::Thread *thread) {
ORBIS_LOG_FATAL("Unhandled scanin ioctl", request);
return {};
}
static const orbis::FileOps fileOps = {
.ioctl = scanin_ioctl,
};
struct ScaninDevice : 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<ScaninFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
};
IoDevice *createScaninCharacterDevice() { return orbis::knew<ScaninDevice>(); }

View file

@ -373,6 +373,11 @@ static void ps4InitDev() {
rx::vfs::addDevice("notification3", createNotificationCharacterDevice(3));
rx::vfs::addDevice("notification4", createNotificationCharacterDevice(4));
rx::vfs::addDevice("notification5", createNotificationCharacterDevice(5));
rx::vfs::addDevice("aout0", createAoutCharacterDevice());
rx::vfs::addDevice("av_control", createAVControlCharacterDevice());
rx::vfs::addDevice("hdmi", createHDMICharacterDevice());
rx::vfs::addDevice("mbus_av", createMBusAVCharacterDevice());
rx::vfs::addDevice("scanin", createScaninCharacterDevice());
orbis::g_context.shmDevice = createShmDevice();
orbis::g_context.blockpoolDevice = createBlockPoolDevice();

View file

@ -73,7 +73,7 @@ uwriteRaw(ptr<void> userAddress, const void *kernelAddress, size_t size) {
return {};
}
template <typename T> [[nodiscard]] ErrorCode uread(T &result, ptr<T> pointer) {
template <typename T> [[nodiscard]] ErrorCode uread(T &result, ptr<const T> pointer) {
return ureadRaw(&result, pointer, sizeof(T));
}
@ -90,7 +90,7 @@ template <typename T, typename U>
}
template <typename T>
[[nodiscard]] ErrorCode uread(T *result, ptr<T> pointer, std::size_t count) {
[[nodiscard]] ErrorCode uread(T *result, ptr<const T> pointer, std::size_t count) {
return ureadRaw(&result, pointer, sizeof(T) * count);
}