diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/devices/src/storage/RAMDisk/RAMDiskDevice.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
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 <kstd/print> +#include <kstd/cstring> #include <cstddef> @@ -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<std::byte *>(m_boot_module.start_address) + offset; - for (size_t i = 0; i < block_size; ++i) - { - kstd::println("address: {}, value: {}", source + i, std::to_integer<unsigned int>(*(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 |
