Interrupt Descriptor Table - Protected Mode

Protected Mode

In protected mode, the IDT is an array of 8-byte descriptors stored consecutively in memory and indexed by an interrupt vector. These descriptors may be either interrupt gates, trap gates or task gates. Interrupt and trap gates point to a memory location containing code to execute by specifying both a segment (present in either the GDT or LDT) and an offset within that segment. The only difference between these two is that an interrupt gate will disable further processor handling of hardware interrupts, making it especially suitable to service hardware interrupts, while a trap gate will leave hardware interrupts enabled and is thus mainly used for handling software interrupts and exceptions. Finally, a task gate will cause the currently active task-state segment to be switched, using the hardware task switch mechanism to effectively hand over use of the processor to another program, thread or process.

The protected mode IDT may reside anywhere in physical memory. The processor has a special register (IDTR) to store both the physical base address and the length in bytes of the IDT. When an interrupt occurs, the processor multiplies the interrupt vector by 8 and adds the result to the IDT base address. With help of the IDT length, the resulting memory address is then verified to be within the table; if it is too large, an exception is generated. If everything is okay, the 8-byte descriptor stored at the calculated memory location is loaded and actions are taken according to the descriptor's type and contents.

A fully populated IDT is 2 KB (256 entries of 8 bytes each) in length. It is not necessary to use all of the possible entries: it is sufficient to populate the IDT up to the highest interrupt vector used, and set the IDT length portion of the IDTR accordingly. Vectors 0-31 are reserved by Intel for processor generated exceptions (general protection fault, page fault, etc.). Though currently only vectors 0-18 are used by the processor, future processors may create incompatibilities for broken software which use these vectors for other purposes.

Read more about this topic:  Interrupt Descriptor Table

Famous quotes containing the words protected and/or mode:

    The rights and interests of the laboring man will be protected and cared for, not by the labor agitators, but by the Christian men to whom God in His infinite wisdom has given control of the property interests of the country.
    George Baer (1842–1914)

    That the mere matter of a poem, for instance—its subject, its given incidents or situation; that the mere matter of a picture—the actual circumstances of an event, the actual topography of a landscape—should be nothing without the form, the spirit of the handling, that this form, this mode of handling, should become an end in itself, should penetrate every part of the matter;Mthis is what all art constantly strives after, and achieves in different degrees.
    Walter Pater (1839–1894)