blob: 40b7160c8611b67a189ceeda7e56c30eecaaebb7 (
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
|
#include "kapi/acpi.hpp"
#include "arch/boot/boot.hpp"
#include <kstd/memory>
#include <acpi/acpi.hpp>
namespace kapi::acpi
{
auto get_root_pointer() -> kstd::observer_ptr<::acpi::rsdp const>
{
auto const & mbi = kapi::boot::bootstrap_information.mbi;
auto system_description_pointer = static_cast<::acpi::rsdp const *>(nullptr);
if (auto const & xsdp = mbi->maybe_acpi_xsdp())
{
auto data = xsdp->pointer().data();
system_description_pointer = reinterpret_cast<::acpi::xsdp const *>(data);
}
else if (auto const & rsdp = mbi->maybe_acpi_rsdp())
{
auto data = rsdp->pointer().data();
system_description_pointer = reinterpret_cast<::acpi::rsdp const *>(data);
}
return kstd::make_observer(system_description_pointer);
}
} // namespace kapi::acpi
|