aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-04-10 08:06:50 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-04-10 08:06:50 +0000
commit5a8659adaa54ce9514db72d1e40f33dec88605ff (patch)
tree199e91f38e0d24971d801bf1c0f99f0a2edf9152
parentf3d84e8645e1f6318c7e34f3524cd332ac6deef5 (diff)
downloadteachos-5a8659adaa54ce9514db72d1e40f33dec88605ff.tar.xz
teachos-5a8659adaa54ce9514db72d1e40f33dec88605ff.zip
Move interrupt count into seperate variable
-rw-r--r--arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp b/arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp
index 9b62110..80f01a8 100644
--- a/arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp
+++ b/arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp
@@ -8,17 +8,20 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
{
namespace
{
+ /// @brief Amount of currently reserved interrupt indicies.
+ /// See https://wiki.osdev.org/Interrupt_Descriptor_Table#IDT_items for more information.
+ constexpr uint8_t RESERVED_INTERRUPT_COUNT = 32U;
+
auto create_interrupt_descriptor_table() -> interrupt_descriptor_table
{
- // Only account for the reserved Vectors for now (0 - 31)
- interrupt_descriptor_table interrupt_descriptor_table{32};
+ interrupt_descriptor_table interrupt_descriptor_table{RESERVED_INTERRUPT_COUNT};
uint64_t offset = reinterpret_cast<uint64_t>(interrupt_handling::generic_interrupt_handler);
segment_selector selector{1U, segment_selector::REQUEST_LEVEL_KERNEL};
ist_offset ist{0U};
idt_flags flags{idt_flags::DESCRIPTOR_LEVEL_KERNEL | idt_flags::INTERRUPT_GATE | idt_flags::PRESENT};
- for (std::size_t i = 0; i < 32; i++)
+ for (std::size_t i = 0; i < interrupt_descriptor_table.size(); i++)
{
interrupt_descriptor_table.at(i) = {selector, ist, flags, offset};
}