mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Change Interrupts::Handler
This commit is contained in:
parent
958e4c792e
commit
6b01a21a71
@ -138,7 +138,7 @@ namespace ACPI
|
||||
}
|
||||
}
|
||||
|
||||
DSDT::DSDT(ACPI *acpi) : Interrupts::Handler(acpi->FADT->SCI_Interrupt + CPU::x86::IRQ0)
|
||||
DSDT::DSDT(ACPI *acpi) : Interrupts::Handler(acpi->FADT->SCI_Interrupt)
|
||||
{
|
||||
this->acpi = acpi;
|
||||
uint64_t Address = ((IsCanonical(acpi->FADT->X_Dsdt) && acpi->XSDTSupported) ? acpi->FADT->X_Dsdt : acpi->FADT->Dsdt);
|
||||
|
@ -347,7 +347,7 @@ namespace APIC
|
||||
this->lapic->Write(APIC_TIMER, timer.raw);
|
||||
}
|
||||
|
||||
Timer::Timer(APIC *apic) : Interrupts::Handler(IRQ0)
|
||||
Timer::Timer(APIC *apic) : Interrupts::Handler(0) /* IRQ0 */
|
||||
{
|
||||
SmartCriticalSection(APICLock);
|
||||
this->lapic = apic;
|
||||
|
@ -77,7 +77,7 @@ static inline int GetLetterFromScanCode(uint8_t ScanCode)
|
||||
|
||||
namespace CrashHandler
|
||||
{
|
||||
CrashKeyboardDriver::CrashKeyboardDriver() : Interrupts::Handler(CPU::x86::IRQ1)
|
||||
CrashKeyboardDriver::CrashKeyboardDriver() : Interrupts::Handler(1) /* IRQ1 */
|
||||
{
|
||||
while (inb(0x64) & 0x1)
|
||||
inb(0x60);
|
||||
|
@ -134,7 +134,11 @@ namespace Interrupts
|
||||
bool InterruptHandled = false;
|
||||
foreach (auto ev in RegisteredEvents)
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
if ((ev.ID + CPU::x86::IRQ0) == static_cast<int>(Frame->InterruptNumber))
|
||||
#elif defined(aa64)
|
||||
if (ev.ID == static_cast<int>(Frame->InterruptNumber))
|
||||
#endif
|
||||
{
|
||||
((Handler *)ev.Data)->OnInterruptReceived(Frame);
|
||||
InterruptHandled = true;
|
||||
@ -174,18 +178,18 @@ namespace Interrupts
|
||||
{
|
||||
if (ev.ID == InterruptNumber)
|
||||
{
|
||||
warn("IRQ%d is already registered.", InterruptNumber - 32);
|
||||
warn("IRQ%d is already registered.", InterruptNumber);
|
||||
}
|
||||
}
|
||||
|
||||
debug("Registering interrupt handler for IRQ%d.", InterruptNumber - 32);
|
||||
debug("Registering interrupt handler for IRQ%d.", InterruptNumber);
|
||||
this->InterruptNumber = InterruptNumber;
|
||||
RegisteredEvents.push_back({InterruptNumber, this});
|
||||
}
|
||||
|
||||
Handler::~Handler()
|
||||
{
|
||||
debug("Unregistering interrupt handler for IRQ%d.", InterruptNumber - 32);
|
||||
debug("Unregistering interrupt handler for IRQ%d.", InterruptNumber);
|
||||
for (size_t i = 0; i < RegisteredEvents.size(); i++)
|
||||
{
|
||||
if (RegisteredEvents[i].ID == InterruptNumber)
|
||||
|
@ -740,7 +740,7 @@ namespace Tasking
|
||||
return Process;
|
||||
}
|
||||
|
||||
Task::Task(const IP EntryPoint) : Interrupts::Handler(CPU::x86::IRQ16)
|
||||
Task::Task(const IP EntryPoint) : Interrupts::Handler(16) /* IRQ16 */
|
||||
{
|
||||
SmartLock(TaskingLock);
|
||||
#if defined(a64)
|
||||
|
@ -33,8 +33,17 @@ namespace Interrupts
|
||||
int InterruptNumber;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Set a new interrupt number.
|
||||
* @param InterruptNumber The interrupt number. NOT the IRQ number! (IRQ0 != 32)
|
||||
*/
|
||||
void SetInterruptNumber(int InterruptNumber) { this->InterruptNumber = InterruptNumber; }
|
||||
int GetInterruptNumber() { return InterruptNumber; }
|
||||
|
||||
/**
|
||||
* @brief Create a new interrupt handler.
|
||||
* @param InterruptNumber The interrupt number. NOT the IRQ number! (IRQ0 != 32)
|
||||
*/
|
||||
Handler(int InterruptNumber);
|
||||
~Handler();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user