![]() |
Max OS 0.3
|
Handles the local APIC for the current core. More...
#include <apic.h>
Public Member Functions | |
| LocalAPIC () | |
| Construct a new Local APIC object and map the APIC base address to the higher half if needed as well as enabling the APIC. | |
| uint32_t | read (uint32_t reg) const |
| read a value from the apic register using the MSR or memory I/O depending on the local apic version | |
| void | write (uint32_t reg, uint32_t value) const |
| write a value to the apic register using the MSR or memory I/O depending on the local apic version | |
| uint32_t | id () const |
| Get the id of the local apic. | |
| void | send_eoi () const |
| Acknowledge that the interrupt has been handled, allowing the PIC to process the next interrupt. | |
| void | send_icr (uint32_t icr_low, uint32_t icr_high, bool use_shorthand) const |
| Send an Interrupt Command Register (ICR) to the local apic. | |
| void | send_init (uint8_t apic_id, bool assert) const |
| send the init IPI to another apic | |
| void | send_startup (uint8_t apic_id, uint8_t vector) const |
| Send the start up IPI to another apic. | |
| void | send_interrupt (uint8_t apic_id, uint8_t vector, size_t flags) const |
| Send an interrupt to a specific core. | |
| LocalAPIC::LocalAPIC | ( | ) |
Construct a new Local APIC object and map the APIC base address to the higher half if needed as well as enabling the APIC.
Definition at line 21 of file apic.cpp.
References MaxOS::system::CPU::cpuid(), MaxOS::Logger::DEBUG(), MaxOS::memory::PhysicalMemoryManager::map(), MaxOS::memory::PRESENT, MaxOS::system::CPU::read_msr(), MaxOS::memory::PhysicalMemoryManager::reserve(), MaxOS::memory::PhysicalMemoryManager::s_current_manager, MaxOS::memory::PhysicalMemoryManager::to_io_region(), MaxOS::Logger::WARNING(), write(), MaxOS::memory::WRITE, and MaxOS::system::CPU::write_msr().
| uint32_t LocalAPIC::id | ( | ) | const |
Get the id of the local apic.
Definition at line 108 of file apic.cpp.
Referenced by id().
| uint32_t LocalAPIC::read | ( | uint32_t | reg | ) | const |
read a value from the apic register using the MSR or memory I/O depending on the local apic version
| reg | The register to read |
Definition at line 76 of file apic.cpp.
References MaxOS::system::CPU::read_msr().
Referenced by id(), and send_icr().
| void LocalAPIC::send_eoi | ( | ) | const |
Acknowledge that the interrupt has been handled, allowing the PIC to process the next interrupt.
Definition at line 120 of file apic.cpp.
References write().
Referenced by MaxOS::hardwarecommunication::InterruptManager::handle_interrupt_request().
| void LocalAPIC::send_icr | ( | uint32_t | icr_low, |
| uint32_t | icr_high, | ||
| bool | use_shorthand | ||
| ) | const |
Send an Interrupt Command Register (ICR) to the local apic.
| icr_low | Lower 32 bits of the ICR (vector, delivery mode, shorthand). |
| icr_high | Upper 32 bits of the ICR (destination APIC ID, if used). |
| use_shorthand | True if a destination shorthand is encoded in icr_low (icr_high is ignored). |
Definition at line 132 of file apic.cpp.
References read(), write(), and MaxOS::system::CPU::write_msr().
Referenced by send_init(), send_interrupt(), and send_startup().
| void LocalAPIC::send_init | ( | uint8_t | apic_id, |
| bool | assert | ||
| ) | const |
send the init IPI to another apic
| apic_id | The id of the apic to send to |
| assert | Is this an assert code (drive / release the signal) |
Definition at line 165 of file apic.cpp.
References send_icr().
Referenced by MaxOS::system::Core::wake_up().
| void LocalAPIC::send_interrupt | ( | uint8_t | apic_id, |
| uint8_t | vector, | ||
| size_t | flags | ||
| ) | const |
Send an interrupt to a specific core.
| apic_id | The core to send to (ignored if specfied in flags) |
| vector | The interrupt vector |
| flags | Flags for how to send |
Definition at line 213 of file apic.cpp.
References send_icr().
Referenced by MaxOS::system::CPU::prepare_for_panic().
| void LocalAPIC::send_startup | ( | uint8_t | apic_id, |
| uint8_t | vector | ||
| ) | const |
Send the start up IPI to another apic.
| apic_id | The apic to send it to |
| vector | Where to start executing |
Definition at line 190 of file apic.cpp.
References send_icr().
Referenced by MaxOS::system::Core::wake_up().
| void LocalAPIC::write | ( | uint32_t | reg, |
| uint32_t | value | ||
| ) | const |
write a value to the apic register using the MSR or memory I/O depending on the local apic version
| reg | The register to write to |
| value | The value to write |
Definition at line 91 of file apic.cpp.
References MaxOS::system::CPU::write_msr().
Referenced by LocalAPIC(), send_eoi(), send_icr(), and MaxOS::hardwarecommunication::Clock::setup_apic_clock().