aboutsummaryrefslogtreecommitdiff
path: root/kernel/devices/src/storage
diff options
context:
space:
mode:
authorLukas Oesch <lukasoesch20@gmail.com>2026-03-02 23:44:53 +0100
committerLukas Oesch <lukasoesch20@gmail.com>2026-03-17 16:42:28 +0100
commit9eeaf95fcc6b2d6302d8447940678e1597d26f0a (patch)
tree9544543b1433cb6f5b904e03d141b5086154dfca /kernel/devices/src/storage
parent62bf2eef72854750c7325d2e2c6e92562a522e16 (diff)
downloadteachos-9eeaf95fcc6b2d6302d8447940678e1597d26f0a.tar.xz
teachos-9eeaf95fcc6b2d6302d8447940678e1597d26f0a.zip
copy data into the buffer in ram_disk_device::read_block
Diffstat (limited to 'kernel/devices/src/storage')
-rw-r--r--kernel/devices/src/storage/RAMDisk/RAMDiskDevice.cpp18
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