Skip to content

Commit

Permalink
🐛 Fix IRQ handling
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Dec 26, 2023
1 parent 757da7b commit bda39ef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion source/Cosmos.Core/INTs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public static void SetIntHandler(byte aIntNo, IRQDelegate aHandler) {
/// <param name="aIrqNo">IRQ index.</param>
/// <param name="aHandler">IRQ handler.</param>
public static void SetIrqHandler(byte aIrqNo, IRQDelegate aHandler) {
IOAPIC.SetEntry(aIrqNo);
IOAPIC.SetEntry((uint)aIrqNo + 0x20);
SetIntHandler((byte)(0x20 + aIrqNo), aHandler);
}

Expand Down
14 changes: 6 additions & 8 deletions source/Cosmos.Core/IOAPIC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,20 @@ public static uint In(byte reg)
/// <summary>
/// Set IO APIC Entry.
/// </summary>
/// <param name="index">Entry index.</param>
/// <param name="data">Data.</param>
/// <param name="lapicId">Local APIC Id.</param>
public static void SetEntry(byte index, ulong data, uint lapicId = 0)
/// <param name="data">Irq ID.</param>
public static void SetEntry(uint irq)
{
Out((byte)(IOREDTBL + index * 2), (uint)data);
Out((byte)(IOREDTBL + index * 2 + 1), (lapicId << 24));
SetEntry((byte)ACPI.RemapIRQ(irq - 0x20), irq);
}

/// <summary>
/// Set IO APIC Entry.
/// </summary>
/// <param name="data">Irq ID.</param>
public static void SetEntry(uint irq)
public static void SetEntry(byte index, ulong data)
{
SetEntry((byte)ACPI.RemapIRQ(irq), 0x20 + irq);
Out((byte)(IOREDTBL + index * 2), (uint)data);
Out((byte)(IOREDTBL + index * 2 + 1), (uint)(data >> 32));
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion source/Cosmos.HAL2/Drivers/Network/AMDPCNetII.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ protected void HandleNetworkInterrupt(ref INTs.IRQContext aContext)
}

StatusRegister = cur_status;
Core.Global.PIC.EoiSlave();
}

/// <summary>
Expand Down

0 comments on commit bda39ef

Please sign in to comment.