0

Loading/Storing

The IDT is loaded using the LIDT assembly instruction. It expects the location of a IDT description structure:

enter image description here

The offset is the virtual address of the table itself. The size is the size of the table subtracted by 1. This structure can be stored to memory again with the SIDT instruction.

It's in http://wiki.osdev.org/Interrupt_Descriptor_Table

Paul R
  • 208,748
  • 37
  • 389
  • 560
Jimmy
  • 353
  • 3
  • 10

1 Answers1

0

IDT descriptor is six byte wide structure that contains information important for loading IDT entries and for interrupt checking.

Let's say that you have mapped PIC interrupts on interrupt 0x40, and that you IDT contains 0x3F entries (its size is 0x1F8). Every interrupt entry has 8-bytes, so when IF (interrupt flag) is set and IMR (interrupt mask register, the thing that filters interrupts) doesn't have mask on it´s first interrupt, PIC will signalize that it wants to fire interrupt. Processor asks: "Ok, what's its number?", and PIC answers "0x40". Processor will calculate offset of interrupt entry (from the start of table) and compare it with first word of IDT descriptor structure. If it's greater than value in IDT descriptor, an exception is thrown (I think that it's #GP).

Offset in IDT descriptor structure is 4-byte address (not physical, paged) that points to the start of IDT. Adding offset calculated from interrupt number leads processor to address of IDT entry.

user35443
  • 6,309
  • 12
  • 52
  • 75