aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-03-30 11:20:08 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-03-30 11:20:08 +0200
commit706f529722520429860ce60237d4ef71b2b27601 (patch)
treea5a4e89ae3ed25b0af521249134e524a0142814f
parent2864e0b061f923a3c73c608b9c27ca4a7116e27c (diff)
parent3070bb45b9741165d786b2c5a018ee55c1a82db8 (diff)
downloadteachos-706f529722520429860ce60237d4ef71b2b27601.tar.xz
teachos-706f529722520429860ce60237d4ef71b2b27601.zip
Merge branch 'fmorgner/interrupt-handling' into develop-BA-FS26
-rw-r--r--.gitlab-ci.yml13
-rw-r--r--.lcovrc2
-rw-r--r--CMakeLists.txt22
-rw-r--r--arch/x86_64/CMakeLists.txt1
-rw-r--r--arch/x86_64/include/arch/cpu/interrupts.hpp49
-rw-r--r--arch/x86_64/kapi/cpu.cpp19
-rw-r--r--arch/x86_64/kapi/interrupts.cpp16
-rw-r--r--arch/x86_64/kapi/system.cpp10
-rw-r--r--arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/gate_descriptor.hpp69
-rw-r--r--arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/idt_flags.hpp81
-rw-r--r--arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.hpp24
-rw-r--r--arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table_pointer.hpp40
-rw-r--r--arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/ist_offset.hpp45
-rw-r--r--arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp105
-rw-r--r--arch/x86_64/pre/include/arch/interrupt_handling/generic_interrupt_handler.hpp34
-rw-r--r--arch/x86_64/pre/include/arch/kernel/cpu/call.hpp30
-rw-r--r--arch/x86_64/pre/include/arch/kernel/cpu/idtr.hpp27
-rw-r--r--arch/x86_64/pre/include/arch/kernel/cpu/if.hpp21
-rw-r--r--arch/x86_64/pre/include/arch/kernel/cpu/msr.hpp64
-rw-r--r--arch/x86_64/pre/include/arch/kernel/cpu/tr.hpp24
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/gate_descriptor.cpp24
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/idt_flags.cpp20
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp53
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table_pointer.cpp13
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/ist_offset.cpp10
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/segment_selector.cpp24
-rw-r--r--arch/x86_64/pre/src/interrupt_handling/generic_interrupt_handler.cpp13
-rw-r--r--arch/x86_64/pre/src/kernel/cpu/call.cpp9
-rw-r--r--arch/x86_64/pre/src/kernel/cpu/idtr.cpp18
-rw-r--r--arch/x86_64/pre/src/kernel/cpu/if.cpp13
-rw-r--r--arch/x86_64/pre/src/kernel/cpu/tr.cpp16
-rw-r--r--arch/x86_64/src/cpu/interrupts.cpp177
-rw-r--r--kapi/CMakeLists.txt15
-rw-r--r--kapi/include/kapi/cpu.hpp104
-rw-r--r--kapi/include/kapi/interrupts.hpp61
-rw-r--r--kernel/CMakeLists.txt11
-rw-r--r--kernel/kapi/cpu.cpp35
-rw-r--r--kernel/kapi/interrupts.cpp65
-rw-r--r--kernel/src/main.cpp5
-rw-r--r--libs/kstd/CMakeLists.txt1
-rw-r--r--libs/kstd/include/kstd/bits/flat_map.hpp82
-rw-r--r--libs/kstd/include/kstd/flat_map320
-rw-r--r--libs/kstd/include/kstd/vector45
-rw-r--r--libs/kstd/tests/src/flat_map.cpp288
-rw-r--r--libs/kstd/tests/src/vector.cpp223
45 files changed, 1450 insertions, 891 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2231956..0b933c4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,10 +6,7 @@
build:
stage: build
- image: registry.gitlab.ost.ch:45023/teachos/devcontainers/x86-64:15.2.0-4
- before_script:
- - apt update
- - apt install -y clang-tidy cmake grub2-common grub-pc mtools ninja-build xorriso
+ image: registry.gitlab.ost.ch:45023/teachos/devcontainers/x86-64.ci:latest
script:
- cmake --preset $PLATFORM
- cmake --build --preset $PLATFORM-$TYPE
@@ -20,14 +17,12 @@ build:
- kernel.elf
- kernel.sym
- kernel.iso
+ expire_in: 1 week
<<: *build_matrix
bht:
stage: build
- image: registry.gitlab.ost.ch:45023/teachos/devcontainers/x86-64:15.2.0-4
- before_script:
- - apt update
- - apt install -y build-essential cmake ninja-build lcov libcatch2-dev gcovr
+ image: registry.gitlab.ost.ch:45023/teachos/devcontainers/bht.ci:latest
script:
- cmake --preset bht
- cmake --build --preset bht-dbg
@@ -38,7 +33,7 @@ bht:
- gcovr --root . --cobertura-pretty --output coverage/cobertura-coverage.xml
after_script:
- echo "CoverageReport public URL - https://teachos.pages.ost.ch/-/kernel/-/jobs/$CI_JOB_ID/artifacts/coverage/index.html"
- coverage: '/Total:\|\s*(\d+(\.\d+)?)\%/'
+ coverage: '/Total:\|\s*(\d+(?:\.\d+)?)\%/'
artifacts:
paths:
- coverage.info
diff --git a/.lcovrc b/.lcovrc
index d19e80d..07da866 100644
--- a/.lcovrc
+++ b/.lcovrc
@@ -1,5 +1,5 @@
exclude = /usr/include/*
-exclude = build/_deps/*
+exclude = build/bht/_deps/*
exclude = tests/*
ignore_errors = unused,empty,inconsistent \ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index febcf0e..6cc8a2f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,15 +18,17 @@ include("GenerateBootableIso")
include("FetchContent")
-FetchContent_Declare(
- "Catch2"
- URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.7.1.tar.gz"
- URL_HASH "SHA256=c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c"
- EXCLUDE_FROM_ALL
- FIND_PACKAGE_ARGS
-)
+if (NOT CMAKE_CROSSCOMPILING)
+ FetchContent_Declare(
+ "Catch2"
+ URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.7.1.tar.gz"
+ URL_HASH "SHA256=c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c"
+ EXCLUDE_FROM_ALL
+ FIND_PACKAGE_ARGS
+ )
-FetchContent_MakeAvailable("Catch2")
+ FetchContent_MakeAvailable("Catch2")
+endif()
#[============================================================================[
# Global Build System Options
@@ -39,6 +41,10 @@ option(TEACHOS_GENERATE_DOCS "Generate documentation during build" ON)
# Global Build System Configuration
#]============================================================================]
+if(POLICY CMP0209)
+ cmake_policy(SET CMP0209 NEW)
+endif()
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION YES)
diff --git a/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt
index 89d9bc0..4427e4c 100644
--- a/arch/x86_64/CMakeLists.txt
+++ b/arch/x86_64/CMakeLists.txt
@@ -15,6 +15,7 @@ target_sources("x86_64" PRIVATE
"kapi/boot_modules.cpp"
"kapi/cio.cpp"
"kapi/cpu.cpp"
+ "kapi/interrupts.cpp"
"kapi/memory.cpp"
"kapi/system.cpp"
diff --git a/arch/x86_64/include/arch/cpu/interrupts.hpp b/arch/x86_64/include/arch/cpu/interrupts.hpp
index 8f156a4..b9adb6e 100644
--- a/arch/x86_64/include/arch/cpu/interrupts.hpp
+++ b/arch/x86_64/include/arch/cpu/interrupts.hpp
@@ -1,6 +1,8 @@
#ifndef TEACHOS_X86_64_CPU_INTERRUPTS_HPP
#define TEACHOS_X86_64_CPU_INTERRUPTS_HPP
+#include "kapi/memory.hpp"
+
#include "arch/cpu/segment_selector.hpp"
#include <array>
@@ -57,36 +59,36 @@ namespace arch::cpu
{
struct
{
- std::uint64_t r15;
- std::uint64_t r14;
- std::uint64_t r13;
- std::uint64_t r12;
- std::uint64_t r11;
- std::uint64_t r10;
- std::uint64_t r9;
- std::uint64_t r8;
- std::uint64_t rdi;
- std::uint64_t rsi;
- std::uint64_t rbp;
- std::uint64_t rdx;
- std::uint64_t rcx;
- std::uint64_t rbx;
- std::uint64_t rax;
+ std::uint64_t r15{};
+ std::uint64_t r14{};
+ std::uint64_t r13{};
+ std::uint64_t r12{};
+ std::uint64_t r11{};
+ std::uint64_t r10{};
+ std::uint64_t r9{};
+ std::uint64_t r8{};
+ std::uint64_t rdi{};
+ std::uint64_t rsi{};
+ std::uint64_t rbp{};
+ std::uint64_t rdx{};
+ std::uint64_t rcx{};
+ std::uint64_t rbx{};
+ std::uint64_t rax{};
} handler_saved;
struct
{
- std::uint64_t number;
- std::uint64_t error_code;
+ std::uint64_t number{};
+ std::uint64_t error_code{};
} interrupt;
struct
{
- std::uint64_t rip;
- std::uint64_t cs;
- std::uint64_t rflags;
- std::uint64_t rsp;
- std::uint64_t ss;
+ kapi::memory::linear_address rip{};
+ std::uint64_t cs{};
+ std::uint64_t rflags{};
+ kapi::memory::linear_address rsp{};
+ std::uint64_t ss{};
} cpu_saved;
};
@@ -109,9 +111,6 @@ namespace arch::cpu
auto static read() -> interrupt_descriptor_table_register;
};
- auto enable_interrupts() -> void;
- auto disable_interrupts() -> void;
-
} // namespace arch::cpu
#endif \ No newline at end of file
diff --git a/arch/x86_64/kapi/cpu.cpp b/arch/x86_64/kapi/cpu.cpp
index 2a0f8f7..12edb0f 100644
--- a/arch/x86_64/kapi/cpu.cpp
+++ b/arch/x86_64/kapi/cpu.cpp
@@ -1,8 +1,27 @@
#include "kapi/cpu.hpp"
+#include "kapi/system.hpp"
+
+#include "arch/cpu/initialization.hpp"
+
+#include <atomic>
+
namespace kapi::cpu
{
+ auto init() -> void
+ {
+ auto static constinit is_initialized = std::atomic_flag{};
+
+ if (is_initialized.test_and_set())
+ {
+ system::panic("[x86_64] CPU has already been initialized.");
+ }
+
+ arch::cpu::initialize_descriptors();
+ arch::cpu::initialize_legacy_interrupts();
+ }
+
auto halt() -> void
{
asm volatile("1: hlt\njmp 1b");
diff --git a/arch/x86_64/kapi/interrupts.cpp b/arch/x86_64/kapi/interrupts.cpp
new file mode 100644
index 0000000..cf1defa
--- /dev/null
+++ b/arch/x86_64/kapi/interrupts.cpp
@@ -0,0 +1,16 @@
+#include "kapi/interrupts.hpp"
+
+namespace kapi::interrupts
+{
+
+ auto enable() -> void
+ {
+ asm volatile("sti");
+ }
+
+ auto disable() -> void
+ {
+ asm volatile("cli");
+ }
+
+} // namespace kapi::interrupts \ No newline at end of file
diff --git a/arch/x86_64/kapi/system.cpp b/arch/x86_64/kapi/system.cpp
index 301169f..09c7152 100644
--- a/arch/x86_64/kapi/system.cpp
+++ b/arch/x86_64/kapi/system.cpp
@@ -1,16 +1,8 @@
#include "kapi/system.hpp"
-#include "arch/cpu/initialization.hpp"
-#include "arch/cpu/interrupts.hpp"
-
namespace kapi::system
{
- auto memory_initialized() -> void
- {
- arch::cpu::initialize_descriptors();
- arch::cpu::initialize_legacy_interrupts();
- arch::cpu::enable_interrupts();
- }
+ auto memory_initialized() -> void {}
} // namespace kapi::system \ No newline at end of file
diff --git a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/gate_descriptor.hpp b/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/gate_descriptor.hpp
deleted file mode 100644
index 07110c8..0000000
--- a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/gate_descriptor.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_GATE_DESCRIPTOR_HPP
-#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_GATE_DESCRIPTOR_HPP
-
-#include "arch/context_switching/interrupt_descriptor_table/idt_flags.hpp"
-#include "arch/context_switching/interrupt_descriptor_table/ist_offset.hpp"
-#include "arch/context_switching/interrupt_descriptor_table/segment_selector.hpp"
-
-#include <bitset>
-#include <cstdint>
-
-namespace teachos::arch::context_switching::interrupt_descriptor_table
-{
- __extension__ typedef __int128 int128_t;
- __extension__ typedef unsigned __int128 uint128_t;
-
- /**
- * @brief Defines helper function for all states and the actual data the gate descriptor can have.
- */
- struct [[gnu::packed]] gate_descriptor
- {
- /**
- * @brief Default Constructor.
- */
- gate_descriptor() = default;
-
- /**
- * @brief Constructor.
- *
- * @note Created gate descriptor copies the given bytes into these components ending with a 32 bit reserved
- * field that has to be used, because the 64-bit gate descriptor needs to be big enough for two 32-bit gate
- * descriptor.
- * - 16 bit Segment Selector
- * - 3 bit Interrupt Stack Table Offset
- * - 8 bit Type and Flags
- * - 64 bit Offset
- *
- * @param flags Copies the bits set from the given data into the individual components of a gate
- * descriptor.
- */
- explicit gate_descriptor(uint128_t flags);
-
- /**
- * @brief Constructor.
- *
- * @param selector, ist, flags, offset Copies the bits set from the given data into the individual components of
- * a gate descriptor.
- */
- gate_descriptor(segment_selector selector, ist_offset ist, idt_flags flags, uint64_t offset);
-
- /**
- * @brief Allows to compare the underlying bits of two instances.
- *
- * @param other Other instance that we want to compare with.
- * @return Whether the underlying set bits of both types are the same.
- */
- auto operator==(gate_descriptor const & other) const -> bool = default;
-
- private:
- // The order in private variables starts for the first variable being the rightmost bit.
- uint16_t _offset_1 = {}; ///< Lower 16 bits of handler function address (0 - 15)
- segment_selector _selector = {}; ///< Segment selector (16 - 31)
- ist_offset _ist = {}; ///< Interrupt Stack Table offset (32 - 39)
- idt_flags _flags = {}; ///< Gate Type and Flags (40 - 47)
- uint64_t _offset_2 : 48 = {}; ///< Upper 48 bits of handler function address (48 - 95)
- uint32_t : 32; ///< Reserved field used to ensure this struct is 128 bits big (96 - 127)
- };
-} // namespace teachos::arch::context_switching::interrupt_descriptor_table
-
-#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_GATE_DESCRIPTOR_HPP
diff --git a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/idt_flags.hpp b/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/idt_flags.hpp
deleted file mode 100644
index 5104c36..0000000
--- a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/idt_flags.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-
-#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_IDT_FLAGS_HPP
-#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_IDT_FLAGS_HPP
-
-#include <bitset>
-#include <cstdint>
-
-namespace teachos::arch::context_switching::interrupt_descriptor_table
-{
- /**
- * @brief Defines helper function for all states that the access byte field of a segment descriptor can
- * have.
- */
- struct [[gnu::packed]] idt_flags
- {
- /**
- * @brief Possible set bits in our underlying bits and the meaning when they are set.
- */
- enum bitset : uint8_t
- {
- INTERRUPT_GATE = 0b01110, ///< The actual type of gate segment is a interrupt gate.
- TRAP_GATE = 0b01111, ///< The actual type of gate segment is a trap gate.
- DESCRIPTOR_LEVEL_KERNEL =
- 0U << 5U, ///< Highest privileged level used by the kernel to allow for full access of resources.
- DESCRIPTOR_LEVEL_ADMIN =
- 1U << 5U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
- ///< than two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
- DESCRIPTOR_LEVEL_PRIVILEGED_USER =
- 2U << 5U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
- ///< than two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
- DESCRIPTOR_LEVEL_USER = 3U << 5U, ///< Restricts access to only application and their specific memory.
- PRESENT = 1U << 7U, ///< Present bit; Allows an entry to refer to a valid segment.
- ///< Must be set (1) for any valid segment.
- };
-
- /**
- * @brief Default Constructor.
- */
- idt_flags() = default;
-
- /**
- * @brief Constructor.
- *
- * @param flags Allows to set flags for the access byte field using the unscoped enum contained in this class, used
- * to allow for direct integer conversion. This value is saved and can later be used to check whether certain flags
- * are enabled or not using contains_flags method.
- */
- idt_flags(uint8_t flags);
-
- /**
- * @brief Checks if the given std::bitset is a subset or equivalent to the underlying data.
- *
- * @note Meaning that all bits that are set in the given std::bitset also have to be set in the underlyng
- * data. Any additional bits that are set are not relevant.
- *
- * @param other Flags that we want to compare against and check if the underlying data has the same bits set.
- * @return Whether the given flags are a subset or equivalent with the underlying data.
- */
- auto contains_flags(std::bitset<8U> other) const -> bool;
-
- /**
- * @brief Allows to compare the underlying bits of two instances.
- *
- * @param other Other instance that we want to compare with.
- * @return Whether the underlying set bits of both types are the same.
- */
- auto operator==(idt_flags const & other) const -> bool = default;
-
- /**
- * @brief Combines all bits that are set in the std::bitset flags with the bits already set in the underlying data.
- *
- * @param other Additional bits that should be set.
- */
- auto operator|=(std::bitset<8U> other) -> void;
-
- private:
- uint8_t _flags = {}; ///< Underlying bits used to read the flags from.
- };
-} // namespace teachos::arch::context_switching::interrupt_descriptor_table
-
-#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_IDT_FLAGS_HPP \ No newline at end of file
diff --git a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.hpp b/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.hpp
deleted file mode 100644
index b388e0e..0000000
--- a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_INTERRUPT_DESCRIPTOR_TABLE_HPP
-#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_INTERRUPT_DESCRIPTOR_TABLE_HPP
-
-#include "arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table_pointer.hpp"
-
-namespace teachos::arch::context_switching::interrupt_descriptor_table
-{
- /**
- * @brief Updates the IDTR with the created interrupt descriptor table. If it has not been created yet this
- * method will create it.
- */
- auto update_interrupt_descriptor_table_register() -> void;
-
- /**
- * @brief Creates the interrupt descriptor table, with the minimum required configuration. If this method is called
- * more than once, the previously created instance is returned instead.
- *
- * @return Reference to the created interrupt_descriptor_table.
- */
- auto get_or_create_interrupt_descriptor_table() -> interrupt_descriptor_table &;
-
-} // namespace teachos::arch::context_switching::interrupt_descriptor_table
-
-#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_INTERRUPT_DESCRIPTOR_TABLE_HPP
diff --git a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table_pointer.hpp b/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table_pointer.hpp
deleted file mode 100644
index 7fe933b..0000000
--- a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/interrupt_descriptor_table_pointer.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_INTERRUPT_DESCRIPTOR_TABLE_POINTER_HPP
-#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_INTERRUPT_DESCRIPTOR_TABLE_POINTER_HPP
-
-#include "arch/context_switching/interrupt_descriptor_table/gate_descriptor.hpp"
-#include "arch/stl/vector.hpp"
-
-namespace teachos::arch::context_switching::interrupt_descriptor_table
-{
- using interrupt_descriptor_table = stl::vector<gate_descriptor>;
-
- /**
- * @brief Represents a pointer to the Interrupt Descriptor Table (IDT).
- *
- * This structure is used to store the base address and length of the IDT.
- */
- struct [[gnu::packed]] interrupt_descriptor_table_pointer
- {
- /**
- * @brief Default constructor.
- */
- interrupt_descriptor_table_pointer() = default;
-
- /**
- * @brief Constructor.
- */
- interrupt_descriptor_table_pointer(uint16_t table_length, gate_descriptor * address);
-
- /**
- * @brief Defaulted three-way comparsion operator.
- */
- auto operator<=>(interrupt_descriptor_table_pointer const & other) const -> std::strong_ordering = default;
-
- private:
- uint16_t table_length = {}; ///< The amount of segment descriptor entries in the global descriptor table - 1.
- gate_descriptor * address = {}; ///< Non-owning pointer to the IDT base address.
- };
-
-} // namespace teachos::arch::context_switching::interrupt_descriptor_table
-
-#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_INTERRUPT_DESCRIPTOR_TABLE_POINTER_HPP
diff --git a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/ist_offset.hpp b/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/ist_offset.hpp
deleted file mode 100644
index e45bcf4..0000000
--- a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/ist_offset.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_IST_OFFSET_HPP
-#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_IST_OFFSET_HPP
-
-#include <bitset>
-#include <cstdint>
-
-namespace teachos::arch::context_switching::interrupt_descriptor_table
-{
- /**
- * @brief Defines helper function for all states that the interrupt stack table offset field of a gate descriptor can
- * have. Is automatically increased to one byte in size, to include the following 5 reserved bits in the gate
- * descriptor.
- */
- struct [[gnu::packed]] ist_offset
- {
- /**
- * @brief Default Constructor.
- */
- ist_offset() = default;
-
- /**
- * @brief Constructor.
- *
- * @param offset Offset into the interrupt stack table. A value of of 0 means we do not switch stacks, whereas 1 - 7
- * mean we switch to the n-th stack in the Interrupt Stack Table, contained in the TSS if the gate descriptor that
- * contains this field is called.
- */
- ist_offset(uint8_t offset);
-
- /**
- * @brief Allows to compare the underlying set bits of two instances.
- *
- * @param other Other instance that we want to compare with.
- * @return Whether the underlying set bits of both types are the same.
- */
- auto operator==(ist_offset const & other) const -> bool = default;
-
- private:
- uint8_t _ist : 3 = {}; ///< Offset into the interrupt stack table. A value of of 0 means we do not switch stacks,
- ///< whereas 1 - 7 mean we switch to the n-th stack in the Interrupt Stack Table, contained
- ///< in the TSS if the gate descriptor that contains this field is called.
- };
-} // namespace teachos::arch::context_switching::interrupt_descriptor_table
-
-#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_IST_OFFSET_HPP
diff --git a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp b/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
deleted file mode 100644
index ea8c145..0000000
--- a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_SEGMENT_SELECTOR_HPP
-#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_INTERRUPT_DESCRIPTOR_TABLE_SEGMENT_SELECTOR_HPP
-
-#include <bitset>
-#include <cstdint>
-
-namespace teachos::arch::context_switching::interrupt_descriptor_table
-{
- /**
- * @brief Represents a segment selector in the x86_64 architecture, which points to a valid code segment in the global
- * descriptor table.
- *
- * A segment selector is a 16-bit identifier used to select a segment descriptor
- * from the Global Descriptor Table (GDT) or the Local Descriptor Table (LDT).
- * It contains an index, a table indicator (TI), and a requested privilege level (RPL).
- */
- struct [[gnu::packed]] segment_selector
- {
- /**
- * @brief Possible set bits in our underlying bits and the meaning when they are set.
- */
- enum bitset : uint8_t
- {
- REQUEST_LEVEL_KERNEL =
- 0U << 0U, ///< Highest privileged level used by the kernel to allow for full access of resources.
- REQUEST_LEVEL_ADMIN =
- 1U << 0U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
- ///< than two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
- REQUEST_LEVEL_PRIVILEGED_USER =
- 2U << 0U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
- ///< than two privilege levels are required, ot