aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-04-06 13:27:22 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-04-06 15:11:47 +0200
commit6e54333bcc08ddd8dbcb6aa9c3404001c309ec74 (patch)
tree5e62c91f7f46db33d62f2f7c04a26d0a04591b65 /kapi
parentbd585306e31889ee4fce60abb79bc3b3a58e2b84 (diff)
downloadteachos-6e54333bcc08ddd8dbcb6aa9c3404001c309ec74.tar.xz
teachos-6e54333bcc08ddd8dbcb6aa9c3404001c309ec74.zip
kapi: move independent implementation to kernel
Diffstat (limited to 'kapi')
-rw-r--r--kapi/CMakeLists.txt8
-rw-r--r--kapi/include/kapi/acpi.hpp2
-rw-r--r--kapi/src/acpi.cpp68
3 files changed, 4 insertions, 74 deletions
diff --git a/kapi/CMakeLists.txt b/kapi/CMakeLists.txt
index eeda158..c9aa23f 100644
--- a/kapi/CMakeLists.txt
+++ b/kapi/CMakeLists.txt
@@ -1,6 +1,4 @@
-add_library("kapi" STATIC
- "src/acpi.cpp"
-)
+add_library("kapi" INTERFACE)
add_library("os::kapi" ALIAS "kapi")
file(GLOB_RECURSE KAPI_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "include/**.hpp")
@@ -12,11 +10,11 @@ target_sources("kapi" PUBLIC
${KAPI_HEADERS}
)
-target_include_directories("kapi" PUBLIC
+target_include_directories("kapi" INTERFACE
"include"
)
-target_link_libraries("kapi" PUBLIC
+target_link_libraries("kapi" INTERFACE
"libs::kstd"
"gcc"
diff --git a/kapi/include/kapi/acpi.hpp b/kapi/include/kapi/acpi.hpp
index 20e5e77..1068921 100644
--- a/kapi/include/kapi/acpi.hpp
+++ b/kapi/include/kapi/acpi.hpp
@@ -12,7 +12,7 @@
namespace kapi::acpi
{
- //! @addtogroup kapi-acpi-api-defined
+ //! @addtogroup kapi-acpi-kernel-defined
//! @{
struct [[gnu::packed]] root_system_description_pointer
diff --git a/kapi/src/acpi.cpp b/kapi/src/acpi.cpp
deleted file mode 100644
index aa0066d..0000000
--- a/kapi/src/acpi.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-#include "kapi/acpi.hpp"
-
-#include "kapi/memory.hpp"
-
-#include <kstd/units>
-
-#include <algorithm>
-#include <bit>
-#include <cstddef>
-#include <cstdint>
-#include <span>
-#include <string_view>
-
-namespace kapi::acpi
-{
-
- namespace
- {
- constexpr auto validate_checksum(std::span<std::byte const> data) -> bool
- {
- auto sum = std::ranges::fold_left(
- data, std::uint8_t{}, [](std::uint8_t acc, auto byte) { return static_cast<std::uint8_t>(byte) + acc; });
- return sum == 0;
- }
- } // namespace
-
- auto root_system_description_pointer::oem_id() const noexcept -> std::string_view
- {
- return {m_oem_id.data(), m_oem_id.size()};
- }
-
- auto root_system_description_pointer::revision() const noexcept -> std::uint8_t
- {
- return m_revision;
- }
-
- auto root_system_description_pointer::signature() const noexcept -> std::string_view
- {
- return {m_signature.data(), m_signature.size()};
- }
-
- auto root_system_description_pointer::table_address() const noexcept -> memory::physical_address
- {
- auto raw = std::bit_cast<std::uint32_t>(m_rsdt_address);
- return memory::physical_address{static_cast<std::uintptr_t>(raw)};
- }
-
- auto root_system_description_pointer::validate() const noexcept -> bool
- {
- return validate_checksum({reinterpret_cast<std::byte const *>(this), sizeof(root_system_description_pointer)});
- }
-
- auto extended_system_description_pointer::length() const noexcept -> kstd::units::bytes
- {
- return kstd::units::bytes{m_length};
- }
-
- auto extended_system_description_pointer::table_address() const noexcept -> memory::physical_address
- {
- return memory::physical_address{std::bit_cast<std::uintptr_t>(m_xsdt_address)};
- }
-
- auto extended_system_description_pointer::validate() const noexcept -> bool
- {
- return validate_checksum({reinterpret_cast<std::byte const *>(this), m_length});
- }
-
-}; // namespace kapi::acpi