Aufgabe 6: Synchronisation
interrupt_handler() Interrupt handler More...
Classes | |
struct | InterruptContext |
Preserved interrupt context. More... | |
Functions | |
void | interrupt_handler (Core::Interrupt::Vector vector, InterruptContext *context) |
High-Level Interrupt Handling. More... | |
Constants | |
void *const | interrupt_entry [] |
Array of function pointer to the default low-level interrupt handlers. More... | |
Detailed Description
interrupt_handler() Interrupt handler
Class Documentation
struct InterruptContext |
Preserved interrupt context.
After an interrupt was triggered, the core first saves the basic context (current code- & stack segment, instruction & stack pointer and the status flags register) and looks up the handling function for the vector using the IDT. In StuBS for each vector an own interrupt_entry_VECTOR
function (written in assembly in interrupt/handler.asm
) was registered during boot by kernel_init(), which all save the scratch registers on the stack before calling the C++ function interrupt_handler(). The high-level handler gets a pointer to the part of the stack which corresponds to the InterruptContext structure as second parameter. After returning from the high-level handler, the previous state is restored from this context (scratch register in assembly and basic context while executing iret
) so it can continue transparently at the previous position.
Variable Documentation
void* const interrupt_entry[] |
Array of function pointer to the default low-level interrupt handlers.
The index corresponds to the vectors entry function, e.g. interrupt_entry[6]
points to interrupt_entry_6
, handling the trap for invalid opcode.
The entry functions and this array are defined in assembly in interrupt/handler.asm
and used in kernel_init() to initialize the Interrupt Descriptor Table (IDT).