diff options
Diffstat (limited to 'kernel/src/test_support/simulated_memory.cpp')
| -rw-r--r-- | kernel/src/test_support/simulated_memory.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/kernel/src/test_support/simulated_memory.cpp b/kernel/src/test_support/simulated_memory.cpp index 49e172f..d23350b 100644 --- a/kernel/src/test_support/simulated_memory.cpp +++ b/kernel/src/test_support/simulated_memory.cpp @@ -5,35 +5,26 @@ #include <cstddef> #include <vector> -namespace kernel::tests::simulated_memory +namespace kernel::tests { - namespace - { - auto constinit ram_storage = std::vector<std::byte>{}; - auto constinit pmm_storage = std::vector<std::byte>{}; - } // namespace - - auto init(kstd::units::bytes size) -> void - { - ram_storage.resize(size / kstd::units::bytes{1}); - pmm_storage.resize(size / kstd::units::bytes{1}); - } + simulated_memory::simulated_memory(kstd::units::bytes size) + : m_memory{size / kstd::units::bytes{1}} + {} - auto reset() -> void + auto simulated_memory::ram_base() noexcept -> std::byte * { - ram_storage.clear(); - pmm_storage.clear(); + return m_memory.data(); } - auto pmm_metadata_base() -> std::byte * + auto simulated_memory::ram_base() const noexcept -> std::byte const * { - return pmm_storage.data(); + return m_memory.data(); } - auto ram_base() -> std::byte * + auto simulated_memory::clear() -> void { - return ram_storage.data(); + m_memory.clear(); } -} // namespace kernel::tests::simulated_memory
\ No newline at end of file +} // namespace kernel::tests
\ No newline at end of file |
