From 9eeaf95fcc6b2d6302d8447940678e1597d26f0a Mon Sep 17 00:00:00 2001 From: Lukas Oesch Date: Mon, 2 Mar 2026 23:44:53 +0100 Subject: copy data into the buffer in ram_disk_device::read_block --- kernel/devices/src/storage/RAMDisk/RAMDiskDevice.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'kernel/devices/src/storage/RAMDisk/RAMDiskDevice.cpp') diff --git a/kernel/devices/src/storage/RAMDisk/RAMDiskDevice.cpp b/kernel/devices/src/storage/RAMDisk/RAMDiskDevice.cpp index 82a3cdf..339e7fa 100644 --- a/kernel/devices/src/storage/RAMDisk/RAMDiskDevice.cpp +++ b/kernel/devices/src/storage/RAMDisk/RAMDiskDevice.cpp @@ -3,7 +3,7 @@ #include "kapi/boot_module/boot_module.hpp" #include "kapi/system.hpp" -#include +#include #include @@ -20,18 +20,12 @@ namespace devices::storage::ram_disk kapi::system::panic("[RAM DISK DEVICE] read_block called with null buffer."); } - auto const offset = block_index * block_size; - // TODO BA-FS26 really correct, what if block_size doesn't divide m_boot_module.size? - if (offset + block_size > m_boot_module.size) - { - kapi::system::panic("[RAM DISK DEVICE] read_block out of bounds."); - } + // TODO BA-FS26 add bounds checking based on module size? + // TODO BA-FS26 fill with 0 after the end of the module, if the block extends beyond it? + auto const offset = block_index * block_size; auto const source = static_cast(m_boot_module.start_address) + offset; - for (size_t i = 0; i < block_size; ++i) - { - kstd::println("address: {}, value: {}", source + i, std::to_integer(*(source + i))); - } - // std::memcpy(buffer, source, block_size); + + kstd::libc::memcpy(buffer, source, block_size); } } // namespace devices::storage::ram_disk \ No newline at end of file -- cgit v1.2.3