Hi,
Stijn wrote:
Where does this limit come from? I can't find it anywhere else, including the 80386 manual. Besides, shouldn't a potential minimum limit be 0x7ff instead of 0xfff (or 0x1000), given an IDT entry size of 8 bytes and and IDT of 256 entries?
The absolute minimum value is zero. In this case any interrupt will cause a triple fault (and in rare cases, like early boot code that switches CPU modes and wants predictable behaviour if an NMI occurs, this might be exactly what you want).
The minimum usable value is "0x0D*8-1 = 0x0067 = 103" or (for long mode where IDT entries are 16 bytes) "0x0D*16-1 = 0x00CF = 207". In this case if a higher numbered interrupt occurs you get a general protection fault (because of the IDT limit) and the general protection fault handler can examine its error code and figure out which interrupt was intended and start the intended interrupt handler.
The maximum value is 0xFFFF, but there are only 256 interrupts so any value from 0x07FF to 0xFFFF (for 32-bit) or from 0x0FFF to 0xFFFF (long mode) would behave the same (allow entries for all 256 possible interrupts). In this way your 0x07FF could be considered the minimum "maximum value".
For normal use the IDT limit can be anything you want. For example, if you want 32 interrupts for exceptions plus 16 interrupts for PIC chips, then you could set the IDT limit to "(32+16)*8-1 = 0x017F = 383" to avoid wasting memory for IDT entries that you don't use.
Cheers,
Brendan