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:
“Wasnt marriage, like life, unstimulating and unprofitable and somewhat empty when too well ordered and protected and guarded. Wasnt it finer, more splendid, more nourishing, when it was, like life itself, a mixture of the sordid and the magnificent; of mud and stars; of earth and flowers; of love and hate and laughter and tears and ugliness and beauty and hurt?”
—Edna Ferber (18871968)
“Poor John Field!I trust he does not read this, unless he will improve by it,thinking to live by some derivative old-country mode in this primitive new country.... With his horizon all his own, yet he a poor man, born to be poor, with his inherited Irish poverty or poor life, his Adams grandmother and boggy ways, not to rise in this world, he nor his posterity, till their wading webbed bog-trotting feet get talaria to their heels.”
—Henry David Thoreau (18171862)