[rpcsx-os] stub /dev/mbus and /dev/notification*

This commit is contained in:
DH 2023-10-30 22:03:38 +03:00
parent 4762166cc4
commit 9865be85af
7 changed files with 98 additions and 4 deletions

View file

@ -415,7 +415,7 @@ static std::string ioctlToString(unsigned long arg) {
orbis::SysResult orbis::sys_ioctl(Thread *thread, sint fd, ulong com,
caddr_t data) {
auto str = ioctlToString(com);
ORBIS_LOG_WARNING(__FUNCTION__, fd, com, str);
// ORBIS_LOG_WARNING(__FUNCTION__, fd, com, str);
Ref<File> file = thread->tproc->fileDescriptors.get(fd);
if (file == nullptr) {
return ErrorCode::BADF;

View file

@ -17,6 +17,8 @@ add_executable(rpcsx-os
iodev/hmd_mmap.cpp
iodev/hmd_snsr.cpp
iodev/icc_configuration.cpp
iodev/mbus.cpp
iodev/notification.cpp
iodev/npdrm.cpp
iodev/null.cpp
iodev/rng.cpp

View file

@ -23,3 +23,5 @@ IoDevice *createShmDevice();
IoDevice *createBlockPoolDevice();
IoDevice *createUrandomCharacterDevice();
IoDevice *createCameraCharacterDevice();
IoDevice *createNotificationCharacterDevice(int index);
IoDevice *createMBusCharacterDevice();

View file

@ -87,7 +87,7 @@ static orbis::ErrorCode gc_ioctl(orbis::File *file, std::uint64_t request,
auto args = reinterpret_cast<Args *>(argp);
ORBIS_LOG_ERROR("gc ioctl 0xc0088101\n", args->arg0, args->arg1);
ORBIS_LOG_ERROR("gc ioctl 0xc0088101", args->arg0, args->arg1);
break;
}

35
rpcsx-os/iodev/mbus.cpp Normal file
View file

@ -0,0 +1,35 @@
#include "io-device.hpp"
#include "orbis/KernelAllocator.hpp"
#include "orbis/file.hpp"
#include "orbis/utils/Logs.hpp"
struct MBusFile : orbis::File {};
struct MBusDevice : IoDevice {
orbis::ErrorCode open(orbis::Ref<orbis::File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
orbis::Thread *thread) override;
};
static orbis::ErrorCode mbus_ioctl(orbis::File *file, std::uint64_t request,
void *argp, orbis::Thread *thread) {
ORBIS_LOG_FATAL("Unhandled mbus ioctl", request);
return {};
}
static const orbis::FileOps fileOps = {
.ioctl = mbus_ioctl,
};
orbis::ErrorCode MBusDevice::open(orbis::Ref<orbis::File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
orbis::Thread *thread) {
auto newFile = orbis::knew<MBusFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
IoDevice *createMBusCharacterDevice() { return orbis::knew<MBusDevice>(); }

View file

@ -0,0 +1,38 @@
#include "io-device.hpp"
#include "orbis/KernelAllocator.hpp"
#include "orbis/file.hpp"
#include "orbis/utils/Logs.hpp"
struct NotificationFile : orbis::File {};
struct NotificationDevice : IoDevice {
int index;
NotificationDevice(int index) : index(index) {}
orbis::ErrorCode open(orbis::Ref<orbis::File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
orbis::Thread *thread) override;
};
static orbis::ErrorCode notification_ioctl(orbis::File *file, std::uint64_t request,
void *argp, orbis::Thread *thread) {
ORBIS_LOG_FATAL("Unhandled notification ioctl", request);
return {};
}
static const orbis::FileOps fileOps = {
.ioctl = notification_ioctl,
};
orbis::ErrorCode NotificationDevice::open(orbis::Ref<orbis::File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
orbis::Thread *thread) {
auto newFile = orbis::knew<NotificationFile>();
newFile->ops = &fileOps;
newFile->device = this;
*file = newFile;
return {};
}
IoDevice *createNotificationCharacterDevice(int index) { return orbis::knew<NotificationDevice>(index); }

View file

@ -322,6 +322,9 @@ static int ps4Exec(orbis::Thread *mainThread,
auto dmem1 = createDmemCharacterDevice(1);
orbis::g_context.dmemDevice = dmem1;
auto stdoutFd = ::open("stdout.txt", O_CREAT | O_TRUNC | O_WRONLY, 0666);
auto stderrFd = ::open("stderr.txt", O_CREAT | O_TRUNC | O_WRONLY, 0666);
rx::vfs::addDevice("dmem0", createDmemCharacterDevice(0));
rx::vfs::addDevice("npdrm", createNpdrmCharacterDevice());
rx::vfs::addDevice("icc_configuration", createIccConfigurationCharacterDevice());
@ -329,8 +332,11 @@ static int ps4Exec(orbis::Thread *mainThread,
rx::vfs::addDevice("camera", createCameraCharacterDevice());
rx::vfs::addDevice("dmem1", dmem1);
rx::vfs::addDevice("dmem2", createDmemCharacterDevice(2));
rx::vfs::addDevice("stdout", createFdWrapDevice(STDOUT_FILENO));
rx::vfs::addDevice("stderr", createFdWrapDevice(STDERR_FILENO));
rx::vfs::addDevice("stdout", createFdWrapDevice(stdoutFd));
rx::vfs::addDevice("stderr", createFdWrapDevice(stderrFd));
rx::vfs::addDevice("deci_stdin", createFdWrapDevice(STDIN_FILENO));
rx::vfs::addDevice("deci_stdout", createFdWrapDevice(stdoutFd));
rx::vfs::addDevice("deci_stderr", createFdWrapDevice(stderrFd));
rx::vfs::addDevice("stdin", createFdWrapDevice(STDIN_FILENO));
rx::vfs::addDevice("zero", createZeroCharacterDevice());
rx::vfs::addDevice("null", createNullCharacterDevice());
@ -346,6 +352,13 @@ static int ps4Exec(orbis::Thread *mainThread,
rx::vfs::addDevice("sbl_srv", createSblSrvCharacterDevice());
rx::vfs::addDevice("ajm", createAjmCharacterDevice());
rx::vfs::addDevice("urandom", createUrandomCharacterDevice());
rx::vfs::addDevice("mbus", createMBusCharacterDevice());
rx::vfs::addDevice("notification0", createNotificationCharacterDevice(0));
rx::vfs::addDevice("notification1", createNotificationCharacterDevice(1));
rx::vfs::addDevice("notification2", createNotificationCharacterDevice(2));
rx::vfs::addDevice("notification3", createNotificationCharacterDevice(3));
rx::vfs::addDevice("notification4", createNotificationCharacterDevice(4));
rx::vfs::addDevice("notification5", createNotificationCharacterDevice(5));
orbis::Ref<orbis::File> stdinFile;
orbis::Ref<orbis::File> stdoutFile;
@ -387,6 +400,10 @@ static int ps4Exec(orbis::Thread *mainThread,
// *reinterpret_cast<std::uint32_t *>(
// reinterpret_cast<std::byte *>(libkernel->base) + 0x6c2e4) = ~0;
*reinterpret_cast<std::uint32_t *>(
reinterpret_cast<std::byte *>(libkernel->base) + 0x71300) = ~0;
StackWriter stack{reinterpret_cast<std::uint64_t>(mainThread->stackEnd)};
for (auto elem : argv) {