Page 1 of 1

what is an interrupt table ?

Posted: Mon May 13, 2002 11:00 pm
by Mr question
What is an interupt table ?
What is an idt ?
What is a GDT ?
are they needed in an OS ?
What do they do ?

RE:what is an interrupt table ?

Posted: Tue May 14, 2002 11:00 pm
by Schol-R-LEA
>On 2002-05-14 22:34:18, Mr question wrote:
>What is an interupt table ?

An interrupt table is a table of addresses for
the interrupt handlers, the system routines (some
of them in BIOS, others added by the OS and the
device drivers) which are called when an
interrupt occurs. When an interrupt occurs (that
is, when either the hardware interrupt line
signals an event on the bus, or an INT
instruction is processed), the CPU jumps to the
handler corresponding to the interrupt number on
the table. When the handler is done, it
automagically returns to the point where the
interrupt occurred. Interrupts 00h-0Fh are
'hard' - they correspond to hardware events -
while those 10h and above are 'soft', and are
used for BIOS calls (and system calls in MS-DOS).

It is necessary to have an interrupt table in
real mode; in fact, you can't *not* have one,
although the entries may not be initialized. If a
interrupt line table entry isn't correctly
initialized, any interrupt which occurs on that
line will cause the system to jump to a bogus
address. This is why, during boot up, interrupts
should be cleared (CLI) except when making BIOS
calls (for video output, reading the disk drive,
etc.), and only set (STI) when the interrupt
table has been initialized for, at minimum, all
of the possible hardware interrupts. Any
interrupt that is never used by the system should
be set to a routine that only performs an IRET
(return form interrupt), or else to an error
handler. The BIOS, by default, initializes the
interrupts for it's own routines, the INT 10h
calls.

Any good book on asembly language programming for
PCs should cover interrupts in dtail; the one I
recommend is Jeff Duntemann's _Assembly Language
Step by Step (Wiley & Sons Inc., ISBN 0-471-
37523-3) For details on the interrupts
themselves, see the Interrupt List
(http://www.ctyme.com/rbrown.htm, or d/l'able at
http://www-2.cs.cmu.edu/afs/cs.cmu.edu/ ... files.html).
While this covers a lot of material that won't be
relevant, it is a useful starting point, and
covers the BIOS routines in detail.

>What is an idt ?
>What is a GDT ?

The Global Descriptor Table is the master table-
of-tables which describes the system staqte in
protected mode. It holds a list of LDT (local
descriptor tables) for all of the processes
currently running.

An IDT (Interrupt Descriptor Table) is the
protected mode equivalent of an interrupt table.
It is possible, IIUC, for different processes to
have different IDTs.

In protected mode, it is necessary to have a GDT,
with at least one dummy entry and one active
entry, and at least one valid IDT.

As always, corrections for any errors I've made
would be appreciated.