mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Refactor MainInterruptHandler
This commit is contained in:
parent
6f76e13c6d
commit
56e47f5cef
@ -282,20 +282,9 @@ namespace Interrupts
|
|||||||
|
|
||||||
extern "C" nsa void MainInterruptHandler(void *Data)
|
extern "C" nsa void MainInterruptHandler(void *Data)
|
||||||
{
|
{
|
||||||
#if defined(a64)
|
CPU::TrapFrame *Frame = (CPU::TrapFrame *)Data;
|
||||||
CPU::x64::TrapFrame *Frame = (CPU::x64::TrapFrame *)Data;
|
|
||||||
#elif defined(a32)
|
|
||||||
CPU::x32::TrapFrame *Frame = (CPU::x32::TrapFrame *)Data;
|
|
||||||
#elif defined(aa64)
|
|
||||||
CPU::aarch64::TrapFrame *Frame = (CPU::aarch64::TrapFrame *)Data;
|
|
||||||
#endif
|
|
||||||
// debug("IRQ%ld", Frame->InterruptNumber - 32);
|
// debug("IRQ%ld", Frame->InterruptNumber - 32);
|
||||||
|
|
||||||
CPUData *CoreData = GetCurrentCPU();
|
|
||||||
int Core = 0;
|
|
||||||
if (likely(CoreData != nullptr))
|
|
||||||
Core = CoreData->ID;
|
|
||||||
|
|
||||||
/* If this is false, we have a big problem. */
|
/* If this is false, we have a big problem. */
|
||||||
if (unlikely(Frame->InterruptNumber >= CPU::x86::IRQ223 ||
|
if (unlikely(Frame->InterruptNumber >= CPU::x86::IRQ223 ||
|
||||||
Frame->InterruptNumber <= CPU::x86::ISR0))
|
Frame->InterruptNumber <= CPU::x86::ISR0))
|
||||||
@ -310,12 +299,12 @@ namespace Interrupts
|
|||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
|
|
||||||
bool InterruptHandled = false;
|
bool InterruptHandled = false;
|
||||||
|
int iEvNum = -1;
|
||||||
foreach (auto &ev in RegisteredEvents)
|
foreach (auto &ev in RegisteredEvents)
|
||||||
{
|
{
|
||||||
|
iEvNum = ev.IRQ;
|
||||||
#if defined(a86)
|
#if defined(a86)
|
||||||
int iEvNum = ev.IRQ + CPU::x86::IRQ0;
|
iEvNum += CPU::x86::IRQ0;
|
||||||
#elif defined(aa64)
|
|
||||||
int iEvNum = ev.IRQ;
|
|
||||||
#endif
|
#endif
|
||||||
if (iEvNum == s_cst(int, Frame->InterruptNumber))
|
if (iEvNum == s_cst(int, Frame->InterruptNumber))
|
||||||
{
|
{
|
||||||
@ -336,6 +325,9 @@ namespace Interrupts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPUData *CoreData = GetCurrentCPU();
|
||||||
|
int Core = CoreData->ID;
|
||||||
|
|
||||||
if (unlikely(!InterruptHandled))
|
if (unlikely(!InterruptHandled))
|
||||||
{
|
{
|
||||||
error("IRQ%d is unhandled on CPU %d.",
|
error("IRQ%d is unhandled on CPU %d.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user