Expand description
Interrupt Descriptor Table (IDT) for Strat9-OS
Handles CPU exceptions and hardware IRQs.
Inspired by MaestroOS idt.rs and Redox-OS kernel.
Modulesยง
- irq
- IRQ interrupt vector numbers (PIC1_OFFSET + IRQ number)
Structsยง
- IdtStorage ๐
- Combined IDT storage + lock in a single struct to prevent memory corruption.
The
static mut InterruptDescriptorTableinitialization was corrupting the adjacentAtomicBoollock. - Idtr ๐
- Interrupt
Return Decision - Decision returned by the raw interrupt trampolines.
- Live
IdtGate Info - Swap
GsGuard ๐ - RAII guard: swap GS to kernel on entry if we came from Ring 3, and restore user GS automatically on drop (covers every exit path including early returns).
Constantsยง
- KERNEL_
CODE_ ๐SELECTOR - Kernel code segment selector for IDT entries.
Staticsยง
- IDT_
STORAGE ๐Wrapper - RESCHED_
IPI_ ๐TRACE_ BUDGET - USER_
PF_ ๐TRACE_ BUDGET
Functionsยง
- ahci_
handler ๐ - AHCI storage controller IRQ handler.
- breakpoint_
handler ๐ - Performs the breakpoint handler operation.
- decode_
error_ ๐code - Decodes
PageFaultErrorCodebits into a human-readable string. - double_
fault_ ๐handler - Performs the double fault handler operation.
- dump_
memory_ ๐bytes - Hex + ASCII dump of
countbytes at virtual addressvaddr. Each page boundary is translated through the raw page tables. - dump_
nearby_ ๐vma_ regions - Dumps VMA regions near the faulting address.
- dump_
page_ ๐fault_ full - Full diagnostic dump for a non-recoverable page fault.
- dump_
page_ ๐table_ walk - Detailed page table walk with flag decoding at every level.
- dump_
user_ ๐pf_ context - Performs the dump user pf context operation.
- format_
pte_ ๐flags - Formats page table entry flags into a short human-readable byte string.
- general_
protection_ ๐fault_ handler - Performs the general protection fault handler operation.
- init
- invalid_
opcode_ ๐handler - Performs the invalid opcode handler operation.
- keyboard_
handler ๐ - Performs the keyboard handler operation.
- lapic_
timer_ ๐ โentry - Raw Local APIC timer interrupt entry.
- lapic_
timer_ ๐handler - Local APIC timer handler (dedicated vector, e.g. 0xD2).
- lapic_
timer_ ๐inner - legacy_
timer_ ๐handler - Legacy external timer IRQ handler (PIC/IOAPIC IRQ0 path, vector 0x20).
- live_
gate_ info - load
- lock_
idt_ ๐storage - mouse_
handler ๐ - PS/2 Mouse IRQ12 handler.
- needs_
swapgs ๐ - Determine whether
swapgsis needed at interrupt/exception entry. - nic_
handler ๐ - NIC IRQ handler
- non_
maskable_ ๐interrupt_ handler - nvme_
handler ๐ - NVMe storage controller IRQ handler.
- page_
fault_ ๐handler - Performs the page fault handler operation.
- register_
ahci_ irq - Register the AHCI storage controller IRQ handler.
- register_
lapic_ timer_ vector - Register the Local APIC timer IRQ vector to use the timer handler.
- register_
nic_ irq - Register the NIC IRQ handler.
- register_
nvme_ irq - Register the NVMe storage controller IRQ handler.
- register_
nvme_ irq_ vector - Register the NVMe storage controller IRQ handler for a specific vector.
- register_
virtio_ block_ irq - Register the VirtIO block device IRQ handler
- register_
xhci_ irq - register_
xhci_ irq_ vector - Register the xHCI USB controller IRQ handler.
- resched_
ipi_ ๐ โentry - Raw reschedule IPI entry.
- resched_
ipi_ ๐handler - Cross-CPU reschedule IPI handler (vector 0xF0).
- resched_
ipi_ ๐inner - spurious_
handler ๐ - Spurious interrupt handler (APIC vector 0xFF). Per Intel SDM: do NOT send EOI for spurious interrupts.
- stack_
segment_ ๐fault_ handler - Performs the stack segment fault handler operation.
- tlb_
shootdown_ ๐handler - Cross-CPU TLB shootdown IPI handler (vector 0xF0).
- translate_
via_ ๐raw_ pt - Translates a virtual address to a physical address via a manual 4-level
page table walk. Returns
Some(phys)orNoneif any level is absent. - unlock_
idt_ ๐storage - virtio_
block_ ๐handler - VirtIO Block device IRQ handler
- xhci_
handler ๐ - xHCI USB controller IRQ handler