Module rstubs::arch::int

source ·
Expand description

§Interrupt handling for x86.

This module contains abstractions for configuring the programmable interrupt controllers:

  • The legacy pic provides backward capabilities. On modern OSes, it is not used anymore and must be disabled when using the modern APICs.
  • The modern “advanced” ioapic and lapic controllers are more capable but also more difficult to configure. The former (IOAPIC) is shared between all cores and the latter (LAPIC) exists for each core.

These interrupt controllers are configured together with the interrupt descriptor table (idt), which is used to define the interrupt-handler functions that are executed for a given interrupt vector.

§Overview

The ASCII art below show the way a keyboard interrupt has to undergo to reach the CPU and the configured interrupt service routine on x86.

+---------+
| CPU 0   |
|         |
|   +-RIDT----> IDT[Vector] => handler
+---|-----+
| LAPIC 0 | <- EOI, Timer, IPI, ...
+----o----+
     |
---o-o------- ... Interrupt Bus
   |
 +-o------+
 | IOAPIC | <- Redirection Table
 +--o---o-+    (Device -> Vector)
   /     \
Keyboard  HDD ...

Modules§

  • Configuring the APIC system.
  • Provides types for the Interrupt Descriptor Table and its entries.
  • Abstraction of the I/O APIC that is used for management of external interrupts.
  • Abstractions for the local APIC for timers, IPI and internal interrupt
  • Configure legacy PIC 8259

Functions§

  • Enable or disable interrupts.
  • Return if interrupts are currently enabled.
  • Enable interrupts and halt execution.
  • Suppresses interrupts during the execution of f and restore the previous status afterwards.