Abstractions for 8259 and 8259A Programmable Interrupt Controllers (PICs).
Things we may not handle very well yet include:
- Dealing with spurious interrupts.
- Non-standard configurations.
This code is based on the OSDev Wiki PIC notes, but it's not a complete implementation of everything they discuss. Also note that if you want to do more sophisticated interrupt handling, especially on multiprocessor systems, you'll probably want to read about the newer APIC and IOAPIC interfaces.
This is a very basic interface to the 8259 and 8259A interrupt controllers, which are used on single processor systems to pass hardware interrupts to the CPU.
To use this crate, add it to your
Cargo.toml file, along with an
appropriate kernel-space mutex implementation such as
You can then declare a global, lockable
ChainedPics object as follows:
// Map PIC interrupts to 0x20 through 0x2f.
static PICS: =
To perform runtime PIC intialization, call
initialize before enabling
When you've finished handling an interrupt, run:
It's safe to call
notify_end_of_interrupt after every interrupt; the
notify_end_of_interrupt function will try to figure out what it needs to
All public PIC interfaces are
unsafe, because it's really easy to trigger
undefined behavior by misconfiguring the PIC or using it incorrectly.