From 50a46b4613f52196e6dfc0714be894ef328e3eea Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Sat, 18 Jan 2025 18:06:43 +0200 Subject: [PATCH] More WIP --- src/core/devices/urandom.cpp | 6 ++++++ src/core/devices/urandom.h | 1 + src/core/libraries/kernel/file_system.cpp | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/core/devices/urandom.cpp b/src/core/devices/urandom.cpp index a09d264b3..033f37444 100644 --- a/src/core/devices/urandom.cpp +++ b/src/core/devices/urandom.cpp @@ -7,6 +7,12 @@ #include "urandom.h" namespace Core::Devices { + +std::shared_ptr URandomDevice::Create(u32 handle, const char*, int, u16) { + return std::shared_ptr( + reinterpret_cast(new URandomDevice(handle))); +} + int URandomDevice::ioctl(u64 cmd, Common::VaCtx* args) { return 0; } diff --git a/src/core/devices/urandom.h b/src/core/devices/urandom.h index 5f76de0af..fc3af2e6e 100644 --- a/src/core/devices/urandom.h +++ b/src/core/devices/urandom.h @@ -10,6 +10,7 @@ class URandomDevice final : BaseDevice { u32 handle; public: + static std::shared_ptr Create(u32 handle, const char*, int, u16); explicit URandomDevice(u32 handle) : handle(handle) {} ~URandomDevice() override = default; diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index 2eb5d1621..85d62935e 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -10,6 +10,7 @@ #include "common/singleton.h" #include "core/devices/logger.h" #include "core/devices/nop_device.h" +#include "core/devices/urandom.h" #include "core/file_sys/fs.h" #include "core/libraries/kernel/file_system.h" #include "core/libraries/kernel/orbis_error.h" @@ -41,6 +42,8 @@ static std::map available_device = { {"/dev/deci_stderr", GET_DEVICE_FD(2)}, {"/dev/null", GET_DEVICE_FD(0)}, // fd0 (stdin) is a nop device + + {"/dev/urandom", &D::URandomDevice::Create } // clang-format on };