From f19681f4dfaaa0bdd3f22e76c48abda3c68bfe0c Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Thu, 3 Apr 2025 08:59:50 +0000 Subject: add documentation to interrupt handler --- .../generic_interrupt_handler.hpp | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'arch') diff --git a/arch/x86_64/include/arch/interrupt_handling/generic_interrupt_handler.hpp b/arch/x86_64/include/arch/interrupt_handling/generic_interrupt_handler.hpp index d828c50..6c1db12 100644 --- a/arch/x86_64/include/arch/interrupt_handling/generic_interrupt_handler.hpp +++ b/arch/x86_64/include/arch/interrupt_handling/generic_interrupt_handler.hpp @@ -6,21 +6,26 @@ namespace teachos::arch::interrupt_handling { /** - * @brief This has been created in a rush. I think it is correct - * - * TODO: Create doxygen + * @brief Represents the CPU state during an interrupt. * + * Some interrupts push an error code, while others do not. The full list + * of which vector number contains the error code can be found here: https://wiki.osdev.org/Exceptions */ - struct interrupt_frame + struct [[gnu::packed]] interrupt_frame { - uint64_t error_code; ///< Error Code (TODO: Potential mistake -> some interrupts contain this field and some dont?) - uint64_t ip; ///< Instruction pointer - uint64_t cs; ///< Code segment - uint64_t flags; ///< RFLAGS - uint64_t sp; ///< Stack pointer - uint64_t ss; ///< Stack segment + uint64_t error_code; ///< Error code pushed by some exceptions. + uint64_t ip; ///< Instruction pointer at the time of the interrupt. + uint64_t cs; ///< Code segment selector indicating privilege level. + uint64_t flags; ///< CPU flags (RFLAGS) storing processor state. + uint64_t sp; ///< Stack pointer at the time of the interrupt. + uint64_t ss; ///< Stack segment selector, usually unused in 64-bit mode. }; + /** + * @brief Generic interrupt handler function. + * + * @param frame Pointer to the interrupt frame containing CPU state. + */ [[gnu::interrupt]] auto generic_interrupt_handler(struct interrupt_frame * frame) -> void; -- cgit v1.2.3