Interrupt Descriptor Table(IDT) & Interrupt Descriptor Table
Register (IDTR)
• "Ever wondered how your CPU knows what to do when you press a key or
move your mouse?"
• "Let's explore how modern processors efficiently manage interrupts!"
3.
Introduction to IDT
•The Interrupt Descriptor Table (IDT) is a crucial data structure in modern
processors.
• It helps the CPU handle hardware interrupts, software interrupts, and
exceptions.
• Located in protected memory and referenced via the IDTR (Interrupt
Descriptor Table Register).
• Used by the processor to map interrupt numbers to their corresponding
handlers.
4.
Structure of IDT
•Each IDT entry is 8 bytes long and contains:
• Offset (32-bit) → Address of the Interrupt Service Routine (ISR).
• Selector (16-bit) → Points to the appropriate segment in GDT/LDT.
• Type & Attributes (16-bit) → Defines interrupt type, privilege levels, and status.
• IDT supports 256 entries (0-255) for various interrupts.
6.
Functions of IDT
•Maps Interrupts to Handlers → Ensures correct execution of interrupt routines.
• Handles System Exceptions → Manages critical CPU faults (e.g., divide by zero).
• Manages Hardware Interrupts → Keyboard, mouse, network, disk I/O, etc.
• Enables Software Interrupts → Allows programs to request kernel services
(syscalls).
• Enhances System Security → Prevents unauthorized modification of interrupt
routines.
7.
IDT Entries
• Entries0-31 → Reserved for CPU exceptions (e.g., Page Fault, General
Protection Fault).
• Entries 32-255 → Used for hardware and software interrupts.
• Each entry is protected to prevent malicious modification.
• Modern OSes restrict access to IDT using kernel-level privileges.
8.
INTERACTION BETWEEN GDT& IDT
• The GDT (Global Descriptor Table) defines segment descriptors (code,
data, TSS).
• IDT uses GDT selectors to locate interrupt handler code segments.
• Both IDT and GDT are essential for protected mode operations.
9.
IDTR (Interrupt DescriptorTable Register)
• Supports 256 Interrupts,
• Stores Base Address & Limit of the IDT.
• 48 Bit Register .
• Defines IDT in physical Memory.
• CPU references IDTR when an interrupt occurs.
• Protected in kernel mode to prevent unauthorized changes.
IDT Security &Protection Mechanisms
• Why is IDT Security Important?
• If malware modifies the IDT, it can hijack system calls & steal data.
• OS prevents this by:
• Setting IDT in protected memory (Ring 0).
• Using Kernel Patch Protection (KPP) in Windows.
14.
Summary
• ✅ IDTis a lookup table mapping interrupts to handlers.
✅ IDTR holds the base & limit of the IDT.
✅ The LIDT instruction loads the IDT into the CPU.
✅ IDT is crucial for OS, virtualization, and security.