<s>
The	O
interrupt	B-General_Concept
descriptor	I-General_Concept
table	I-General_Concept
(	O
IDT	O
)	O
is	O
a	O
data	O
structure	O
used	O
by	O
the	O
x86	B-Operating_System
architecture	I-Operating_System
to	O
implement	O
an	O
interrupt	B-General_Concept
vector	I-General_Concept
table	I-General_Concept
.	O
</s>
<s>
The	O
IDT	O
is	O
used	O
by	O
the	O
processor	O
to	O
determine	O
the	O
correct	O
response	O
to	O
interrupts	B-Application
and	O
exceptions	B-General_Concept
.	O
</s>
<s>
The	O
details	O
in	O
the	O
description	O
below	O
apply	O
specifically	O
to	O
the	O
x86	B-Operating_System
architecture	I-Operating_System
and	O
the	O
AMD64	B-Device
architecture	O
.	O
</s>
<s>
Use	O
of	O
the	O
IDT	O
is	O
triggered	O
by	O
three	O
types	O
of	O
events	O
:	O
hardware	O
interrupts	B-Application
,	O
software	O
interrupts	B-Application
,	O
and	O
processor	O
exceptions	B-General_Concept
,	O
which	O
together	O
are	O
referred	O
to	O
as	O
interrupts	B-Application
.	O
</s>
<s>
The	O
IDT	O
consists	O
of	O
256	O
interrupt	B-General_Concept
vectors	I-General_Concept
–	O
the	O
first	O
32	O
(	O
0	O
–	O
31	O
or	O
0x00	O
–	O
0x1F	O
)	O
of	O
which	O
are	O
used	O
for	O
processor	O
exceptions	B-General_Concept
.	O
</s>
<s>
In	O
real	B-Application
mode	I-Application
,	O
the	O
interrupt	B-Application
table	O
is	O
called	O
IVT	O
(	O
interrupt	B-General_Concept
vector	I-General_Concept
table	I-General_Concept
)	O
.	O
</s>
<s>
Up	O
to	O
the	O
80286	B-General_Concept
,	O
the	O
IVT	O
always	O
resided	O
at	O
the	O
same	O
location	O
in	O
memory	O
,	O
ranging	O
from	O
0x0000	O
to	O
0x03ff	O
,	O
and	O
consisted	O
of	O
256	O
far	B-General_Concept
pointers	I-General_Concept
.	O
</s>
<s>
Hardware	O
interrupts	B-Application
may	O
be	O
mapped	O
to	O
any	O
of	O
the	O
vectors	O
by	O
way	O
of	O
a	O
programmable	O
interrupt	B-Application
controller	O
.	O
</s>
<s>
On	O
the	O
80286	B-General_Concept
and	O
later	O
,	O
the	O
size	O
and	O
locations	O
of	O
the	O
IVT	O
can	O
be	O
changed	O
in	O
the	O
same	O
way	O
as	O
it	O
is	O
done	O
with	O
the	O
IDT	O
(	O
Interrupt	B-General_Concept
descriptor	I-General_Concept
table	I-General_Concept
)	O
in	O
protected	B-Application
mode	I-Application
(	O
i.e.	O
,	O
via	O
the	O
LIDT	O
(	O
Load	O
Interrupt	B-General_Concept
Descriptor	I-General_Concept
Table	I-General_Concept
Register	O
)	O
instruction	O
)	O
though	O
it	O
does	O
not	O
change	O
the	O
format	O
of	O
it	O
.	O
</s>
<s>
The	O
BIOS	O
provides	O
simple	O
real-mode	B-Application
access	O
to	O
a	O
subset	O
of	O
hardware	O
facilities	O
by	O
registering	O
interrupt	B-Application
handlers	O
.	O
</s>
<s>
They	O
are	O
invoked	O
as	O
software	O
interrupts	B-Application
with	O
the	O
INT	O
instruction	O
and	O
the	O
parameters	O
are	O
passed	O
via	O
registers	O
.	O
</s>
<s>
the	O
system	O
memory	B-General_Concept
layout	I-General_Concept
,	O
configuring	O
VGA	B-Protocol
output	O
and	O
modes	O
,	O
and	O
accessing	O
the	O
disk	O
early	O
in	O
the	O
boot	O
process	O
.	O
</s>
<s>
It	O
is	O
not	O
necessary	O
to	O
use	O
all	O
of	O
the	O
possible	O
entries	O
:	O
it	O
is	O
sufficient	O
to	O
populate	O
the	O
table	O
up	O
to	O
the	O
highest	O
interrupt	B-General_Concept
vector	I-General_Concept
used	O
,	O
and	O
set	O
the	O
IDT	O
length	O
portion	O
of	O
the	O
accordingly	O
.	O
</s>
<s>
When	O
an	O
interrupt	B-Application
occurs	O
,	O
the	O
processor	O
multiplies	O
the	O
interrupt	B-General_Concept
vector	I-General_Concept
by	O
the	O
entry	O
size	O
(	O
8	O
for	O
protected	B-Application
mode	I-Application
,	O
16	O
for	O
long	O
mode	O
)	O
and	O
adds	O
the	O
result	O
to	O
the	O
IDT	O
base	O
address	O
.	O
</s>
<s>
If	O
the	O
address	O
is	O
inside	O
the	O
table	O
,	O
the	O
DPL	O
is	O
checked	O
and	O
the	O
interrupt	B-Application
is	O
handled	O
based	O
on	O
the	O
gate	O
type	O
.	O
</s>
<s>
The	O
descriptors	O
may	O
be	O
either	O
interrupt	B-Application
gates	O
,	O
trap	B-Application
gates	O
or	O
,	O
for	O
32-bit	O
protected	B-Application
mode	I-Application
only	O
,	O
task	O
gates	O
.	O
</s>
<s>
Interrupt	B-Application
and	O
trap	B-Application
gates	O
point	O
to	O
a	O
memory	O
location	O
containing	O
code	O
to	O
execute	O
by	O
specifying	O
both	O
a	O
segment	O
(	O
present	O
in	O
either	O
the	O
GDT	B-General_Concept
or	O
LDT	B-General_Concept
)	O
and	O
an	O
offset	O
within	O
that	O
segment	O
.	O
</s>
<s>
The	O
only	O
difference	O
between	O
trap	B-Application
and	O
interrupt	B-Application
gates	O
is	O
that	O
interrupt	B-Application
gates	O
will	O
disable	O
further	O
processor	O
handling	O
of	O
maskable	O
hardware	O
interrupts	B-Application
,	O
making	O
them	O
suitable	O
to	O
handle	O
hardware-generated	O
interrupts	B-Application
(	O
conversely	O
,	O
trap	B-Application
gates	O
are	O
useful	O
for	O
handling	O
software	O
interrupts	B-Application
and	O
exceptions	B-General_Concept
)	O
.	O
</s>
<s>
All	O
INT_NUM	O
between	O
0x0	O
and	O
0x1F	O
,	O
inclusive	O
,	O
are	O
reserved	O
for	O
exceptions	B-General_Concept
;	O
INT_NUM	O
bigger	O
than	O
0x1F	O
are	O
used	O
for	O
interrupt	B-Application
routines	O
.	O
</s>
<s>
(	O
the	O
IBM	B-Device
PC	I-Device
did	O
not	O
always	O
obey	O
this	O
rule	O
,	O
for	O
instance	O
using	O
interrupt	B-Application
5	O
to	O
indicate	O
the	O
Print	B-Device
Screen	I-Device
key	I-Device
was	O
pressed	O
.	O
)	O
</s>
<s>
This	O
involves	O
writing	O
a	O
kernel	O
mode	O
driver	B-Application
that	O
intercepts	O
calls	O
to	O
the	O
IDT	O
and	O
adds	O
in	O
its	O
own	O
processing	O
.	O
</s>
<s>
This	O
has	O
never	O
been	O
officially	O
supported	O
by	O
Microsoft	O
,	O
but	O
was	O
not	O
programatically	O
prevented	O
on	O
its	O
operating	O
systems	O
until	O
64-bit	B-Device
versions	O
of	O
Windows	O
,	O
where	O
a	O
driver	B-Application
that	O
attempts	O
to	O
use	O
a	O
kernel	O
mode	O
hook	O
will	O
cause	O
the	O
machine	O
to	O
bug	B-Error_Name
check	I-Error_Name
.	O
</s>
