aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi/boot_modules.cpp
blob: 5a0ef7f770e8ccdf5111b3371d4370120bd6beb7 (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
34
#include "kapi/boot_modules.hpp"

#include "kapi/system.hpp"

#include <optional>

namespace kapi::boot_modules
{

  namespace
  {
    constinit auto static registry = std::optional<kapi::boot_modules::boot_module_registry>{};
  }  // namespace

  auto set_boot_module_registry(boot_module_registry & new_registry) -> void
  {
    if (registry)
    {
      system::panic("[x86_64] Boot module registry has already been set.");
    }

    registry = new_registry;
  }

  auto get_boot_module_registry() -> boot_module_registry &
  {
    if (!registry)
    {
      system::panic("[x86_64] Boot module registry has not been initialized.");
    }

    return *registry;
  }
}  // namespace kapi::boot_modules