diff options
Diffstat (limited to 'arch/x86_64/src')
3 files changed, 7 insertions, 10 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 b520a57..82114b4 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 @@ -10,20 +10,19 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table { auto create_interrupt_descriptor_table() -> interrupt_descriptor_table { - // TODO: See 7.14 Vol. 3A Page 3299 Intel Manual, still crashes from time to time on setting interrupt flag? - // Probably an interrupt is generated but the interrupt descriptor table is not in a valid form and does not - // handle the interrupt. - interrupt_descriptor_table interrupt_descriptor_table{256}; + // Only account for the reserved Vectors for now (0 - 31) + interrupt_descriptor_table interrupt_descriptor_table{32}; - uint64_t offset = 0U; - segment_selector selector{1U, segment_selector::REQUEST_LEVEL_KERNEL}; + uint64_t offset = reinterpret_cast<uint64_t>(interrupt_handling::generic_interrupt_handler); + segment_selector selector{2U, 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 < 256; i++) + for (std::size_t i = 0; i < 32; i++) { interrupt_descriptor_table.at(i) = {selector, ist, flags, offset}; } + return interrupt_descriptor_table; } } // namespace diff --git a/arch/x86_64/src/context_switching/main.cpp b/arch/x86_64/src/context_switching/main.cpp index 2b853ec..ac53735 100644 --- a/arch/x86_64/src/context_switching/main.cpp +++ b/arch/x86_64/src/context_switching/main.cpp @@ -22,8 +22,6 @@ namespace teachos::arch::context_switching segment_descriptor_table::update_task_state_segment_register(); - // FIXME: We currently cannot enable interrupts, since for some reason, we will later run into what looks like a GP - // and triple fault. kernel::cpu::set_interrupt_flag(); descriptor_tables tables = {segment_descriptor_table::get_or_create_global_descriptor_table(), diff --git a/arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp b/arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp index 2f599e5..4392b04 100644 --- a/arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp +++ b/arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp @@ -5,7 +5,7 @@ namespace teachos::arch::interrupt_handling { - [[gnu::interrupt]] + [[gnu::interrupt]] [[gnu::section(".interrupt_text")]] auto generic_interrupt_handler(interrupt_frame * frame) -> void { (void)frame; |
