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:

    U.S. international and security policy ... has as its primary goal the preservation of what we might call “the Fifth Freedom,” understood crudely but with a fair degree of accuracy as the freedom to rob, to exploit and to dominate, to undertake any course of action to ensure that existing privilege is protected and advanced.
    Noam Chomsky (b. 1928)

    The mode of founding a college is, commonly, to get up a subscription of dollars and cents, and then, following blindly the principles of a division of labor to its extreme,—a principle which should never be followed but with circumspection,—to call in a contractor who makes this a subject of speculation,... and for these oversights successive generations have to pay.
    Henry David Thoreau (1817–1862)