![]() |
Max OS 0.3
|
Handles all interrupts and passes them to the correct handler. More...
#include <interrupts.h>
Public Member Functions | |
| InterruptManager () | |
| Constructs the Interrupt Manager and sets up the interrupt descriptor table (does not activate interrupts) | |
| ~InterruptManager () | |
| Destroys the Interrupt Manager and deactivates interrupts. | |
| void | set_interrupt_handler (uint8_t interrupt, InterruptHandler *handler) |
| Sets the interrupt handler for the interrupt. | |
| void | remove_interrupt_handler (uint8_t interrupt) |
| Removes the interrupt handler for the interrupt. | |
| void | set_apic (AdvancedProgrammableInterruptController *apic) |
| Sets the APIC. | |
| AdvancedProgrammableInterruptController * | active_apic () |
| Gets the APIC. | |
| void | activate () |
| Activates the interrupt manager and starts interrupts (also deactivates the current interrupt manager) | |
Static Public Member Functions | |
| static InterruptManager * | active_interrupt_manager () |
| Gets the active interrupt manager. | |
| static void | load_current () |
| Tell the processor to use the current InterruptManager. | |
| static void | deactivate () |
| Deactivates the interrupt manager and stops interrupts. | |
| static void | ForceInterruptReturn (system::cpu_status_t *state) |
| Force the CPU to return from an interrupt (see interrupts.s) | |
Protected Member Functions | |
| system::cpu_status_t * | handle_interrupt_request (system::cpu_status_t *status) |
| Handles the interrupt request by passing it to the appropriate handler. | |
Static Protected Member Functions | |
| static void | set_interrupt_descriptor_table_entry (uint8_t interrupt, void(*handler)(), uint8_t descriptor_privilege_level) |
| Sets an entry in the Interrupt Descriptor Table. | |
| static void | HandleInterruptRequest0x00 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x01 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x02 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x03 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x04 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x05 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x06 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x07 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x08 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x09 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x0A () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x0B () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x0C () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x0D () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x0E () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x80 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x0F () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x31 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptRequest0x60 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x00 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x01 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x02 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x03 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x04 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x05 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x06 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x07 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptError0x08 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x09 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptError0x0A () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptError0x0B () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptError0x0C () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptError0x0D () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptError0x0E () |
| Stub (see interrupts.s) | |
| static void | HandleException0x0F () |
| Stub (see interrupts.s) | |
| static void | HandleException0x10 () |
| Stub (see interrupts.s) | |
| static void | HandleInterruptError0x11 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x12 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x13 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x14 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x15 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x16 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x17 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x18 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x19 () |
| Stub (see interrupts.s) | |
| static void | HandleException0x1A () |
| Stub (see interrupts.s) | |
| static void | HandleException0x1B () |
| Stub (see interrupts.s) | |
| static void | HandleException0x1C () |
| Stub (see interrupts.s) | |
| static void | HandleException0x1D () |
| Stub (see interrupts.s) | |
| static void | HandleException0x1E () |
| Stub (see interrupts.s) | |
| static void | HandleException0x1F () |
| Stub (see interrupts.s) | |
| static system::cpu_status_t * | HandleInterrupt (system::cpu_status_t *status) |
| Handles the interrupt request by passing it to the interrupt manager. | |
Protected Attributes | |
| InterruptHandler * | m_interrupt_handlers [MAX_INTERRUPT_HANDLERS] = { } |
| A map of index-to-interrupt of interrupt handlers to fire when an interrupt occurs. | |
Static Protected Attributes | |
| static InterruptManager * | s_active_interrupt_manager = nullptr |
| The interrupt manger that is currently handling interrupts and is loaded into the IDTR. | |
| static InterruptDescriptor | s_interrupt_descriptor_table [MAX_INTERRUPT_HANDLERS] = { } |
| The Interrupt Descriptor Table (IDT) | |
Friends | |
| class | InterruptHandler |
Handles all interrupts and passes them to the correct handler.
Remove the max array of handler make vector, add static handlers for page faults and gpe. Make it so that multiple handlers can be registered for the same interrupt
Have a single stub so that we don't need to have 256 different functions for each interrupt
Definition at line 84 of file interrupts.h.
| InterruptManager::InterruptManager | ( | ) |
Constructs the Interrupt Manager and sets up the interrupt descriptor table (does not activate interrupts)
Definition at line 90 of file interrupts.cpp.
References HandleException0x00(), HandleException0x01(), HandleException0x02(), HandleException0x03(), HandleException0x04(), HandleException0x05(), HandleException0x06(), HandleException0x07(), HandleException0x09(), HandleException0x0F(), HandleException0x10(), HandleException0x12(), HandleException0x13(), HandleException0x14(), HandleException0x15(), HandleException0x16(), HandleException0x17(), HandleException0x18(), HandleException0x19(), HandleException0x1A(), HandleException0x1B(), HandleException0x1C(), HandleException0x1D(), HandleException0x1E(), HandleException0x1F(), HandleInterruptError0x08(), HandleInterruptError0x0A(), HandleInterruptError0x0B(), HandleInterruptError0x0C(), HandleInterruptError0x0D(), HandleInterruptError0x0E(), HandleInterruptError0x11(), HandleInterruptRequest0x00(), HandleInterruptRequest0x01(), HandleInterruptRequest0x02(), HandleInterruptRequest0x0C(), HandleInterruptRequest0x60(), MaxOS::hardwarecommunication::HARDWARE_INTERRUPT_OFFSET, MaxOS::Logger::INFO(), load_current(), s_active_interrupt_manager, s_interrupt_descriptor_table, and set_interrupt_descriptor_table_entry().
| InterruptManager::~InterruptManager | ( | ) |
Destroys the Interrupt Manager and deactivates interrupts.
Definition at line 155 of file interrupts.cpp.
References deactivate().
| void InterruptManager::activate | ( | ) |
Activates the interrupt manager and starts interrupts (also deactivates the current interrupt manager)
Definition at line 201 of file interrupts.cpp.
References deactivate(), MaxOS::Logger::INFO(), and s_active_interrupt_manager.
| AdvancedProgrammableInterruptController * InterruptManager::active_apic | ( | ) |
Gets the APIC.
Definition at line 382 of file interrupts.cpp.
|
static |
Gets the active interrupt manager.
Definition at line 392 of file interrupts.cpp.
References s_active_interrupt_manager.
Referenced by MaxOS::hardwarecommunication::AdvancedProgrammableInterruptController::AdvancedProgrammableInterruptController().
|
static |
Deactivates the interrupt manager and stops interrupts.
Definition at line 216 of file interrupts.cpp.
References s_active_interrupt_manager.
Referenced by activate(), and ~InterruptManager().
|
static |
Force the CPU to return from an interrupt (see interrupts.s)
| state | the state to return to |
Referenced by MaxOS::common::BlockingLock::acquire().
|
protected |
Handles the interrupt request by passing it to the appropriate handler.
| status | The current cpu status |
Definition at line 284 of file interrupts.cpp.
References MaxOS::system::CPU::executing_core(), MaxOS::hardwarecommunication::InterruptHandler::handle_interrupt(), MaxOS::hardwarecommunication::HARDWARE_INTERRUPT_OFFSET, m_interrupt_handlers, and MaxOS::Logger::WARNING().
|
staticprotected |
Handles the interrupt request by passing it to the interrupt manager.
| status | The current cpu status |
Definition at line 233 of file interrupts.cpp.
References MaxOS::system::CPU::PANIC(), and s_active_interrupt_manager.
|
static |
Tell the processor to use the current InterruptManager.
Definition at line 190 of file interrupts.cpp.
References s_interrupt_descriptor_table.
Referenced by MaxOS::system::Core::init(), and InterruptManager().
Removes the interrupt handler for the interrupt.
| interrupt | The interrupt number |
Definition at line 273 of file interrupts.cpp.
References m_interrupt_handlers.
| void InterruptManager::set_apic | ( | AdvancedProgrammableInterruptController * | apic | ) |
Sets the APIC.
| apic | The APIC |
Definition at line 308 of file interrupts.cpp.
Referenced by MaxOS::hardwarecommunication::AdvancedProgrammableInterruptController::AdvancedProgrammableInterruptController().
|
staticprotected |
Sets an entry in the Interrupt Descriptor Table.
| interrupt | Interrupt number |
| handler | Interrupt Handler |
| descriptor_privilege_level | Descriptor Privilege Level |
Definition at line 166 of file interrupts.cpp.
References s_interrupt_descriptor_table.
Referenced by InterruptManager().
| void InterruptManager::set_interrupt_handler | ( | uint8_t | interrupt, |
| InterruptHandler * | handler | ||
| ) |
Sets the interrupt handler for the interrupt.
| interrupt | The interrupt number |
| handler | The interrupt handler |
Definition at line 263 of file interrupts.cpp.
References m_interrupt_handlers.
|
friend |
Definition at line 85 of file interrupts.h.
|
protected |
A map of index-to-interrupt of interrupt handlers to fire when an interrupt occurs.
Definition at line 97 of file interrupts.h.
Referenced by handle_interrupt_request(), remove_interrupt_handler(), and set_interrupt_handler().
|
inlinestaticprotected |
The interrupt manger that is currently handling interrupts and is loaded into the IDTR.
Definition at line 95 of file interrupts.h.
Referenced by activate(), active_interrupt_manager(), deactivate(), HandleInterrupt(), MaxOS::hardwarecommunication::InterruptHandler::InterruptHandler(), InterruptManager(), and MaxOS::hardwarecommunication::InterruptHandler::~InterruptHandler().
|
inlinestaticprotected |
The Interrupt Descriptor Table (IDT)
Definition at line 98 of file interrupts.h.
Referenced by InterruptManager(), load_current(), and set_interrupt_descriptor_table_entry().