aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
authorFabian Imhof <fabian.imhof@ost.ch>2025-04-03 08:59:50 +0000
committerFabian Imhof <fabian.imhof@ost.ch>2025-04-03 08:59:50 +0000
commitf19681f4dfaaa0bdd3f22e76c48abda3c68bfe0c (patch)
tree8f727f0af14c2e6ba0f5410c16e2a4b1c88cd645 /arch/x86_64
parentfc4a2306b803ccfc27f1bdc4a831176a5278a9d5 (diff)
downloadteachos-f19681f4dfaaa0bdd3f22e76c48abda3c68bfe0c.tar.xz
teachos-f19681f4dfaaa0bdd3f22e76c48abda3c68bfe0c.zip
add documentation to interrupt handler
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/include/arch/interrupt_handling/generic_interrupt_handler.hpp25
1 files changed, 15 insertions, 10 deletions
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;