aboutsummaryrefslogtreecommitdiff
path: root/kernel/tests/src/simulated_memory.cpp
blob: 9a9b35499350f52c40a37940f5b3cc0663237ffb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "kernel/tests/simulated_memory.hpp"

#include <kstd/units>

#include <cstddef>
#include <vector>

namespace kernel::tests::simulated_memory
{

  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});
  }

  auto pmm_metadata_base() -> std::byte *
  {
    return pmm_storage.data();
  }

  auto ram_base() -> std::byte *
  {
    return ram_storage.data();
  }

}  // namespace kernel::tests::simulated_memory