1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML 2.0//EN">
4 <TITLE>80386 Programmer's Reference Manual -- Section
2.6</TITLE>
7 <B>up:
</B> <A HREF=
"c02.htm">
8 Chapter
2 -- Basic Programming Model
</A><BR>
9 <B>prev:
</B> <A HREF=
"s02_05.htm">2.5 Operand Selection
</A><BR>
11 <A HREF=
"c03.htm">Chapter
3 -- Applications Instruction Set
</A><BR>
15 <H1>2.6 Interrupts and Exceptions
</H1>
16 The
80386 has two mechanisms for interrupting program execution:
18 <LI>Exceptions are synchronous events that are the responses of the CPU
19 to certain conditions detected during the execution of an instruction.
20 <LI>Interrupts are asynchronous events typically triggered by external
21 devices needing attention.
23 Interrupts and exceptions are alike in that both cause the processor to
24 temporarily suspend its present program execution in order to execute a
25 program of higher priority. The major distinction between these two kinds of
26 interrupts is their origin. An exception is always reproducible by
27 re-executing with the program and data that caused the exception, whereas an
28 interrupt is generally independent of the currently executing program.
30 Application programmers are not normally concerned with servicing
31 interrupts. More information on interrupts for systems programmers may be
33 <A HREF=
"c09.htm">Chapter
9</A>
34 . Certain exceptions , however, are of interest to
35 applications programmers, and many operating systems give applications
36 programs the opportunity to service these exceptions. However, the operating
37 system itself defines the interface between the applications programs and
38 the exception mechanism of the
80386.
40 Table
2-
2 highlights the exceptions that may be of interest to applications
43 <LI> A divide error exception results when the instruction
44 <A HREF=
"DIV.htm">DIV
</A> or
45 <A HREF=
"IDIV.htm">IDIV
</A> is
46 executed with a zero denominator or when the quotient is too large for
47 the destination operand . (Refer to
48 <A HREF=
"c03.htm">Chapter
3</A>
49 for a discussion of
<A HREF=
"DIV.htm">DIV
</A>
50 and
<A HREF=
"IDIV.htm">IDIV
</A>.)
51 <LI> The debug exception may be reflected back to an applications program
52 if it results from the trap flag (TF).
53 <LI> A breakpoint exception results when the instruction
54 <A HREF=
"INT.htm">INT
3</A> is executed.
55 This instruction is used by some debuggers to stop program execution at
57 <LI> An overflow exception results when the
58 <A HREF=
"INT.htm">INTO
</A> instruction is executed
59 and the OF (overflow) flag is set (after an arithmetic operation that
60 set the OF flag ) . (Refer to
61 <A HREF=
"c03.htm">Chapter
3</A>
62 for a discussion of
<A HREF=
"INT.htm">INTO
</A>) .
63 <LI> A bounds check exception results when the
64 <A HREF=
"BOUND.htm">BOUND
</A> instruction is
65 executed and the array index it checks falls outside the bounds of the
67 <A HREF=
"c03.htm">Chapter
3</A>
68 for a discussion of the
<A HREF=
"BOUND.htm">BOUND
</A> instruction. )
69 <LI> Invalid opcodes may be used by some applications to extend the
70 instruction set. In such a case, the invalid opcode exception presents
71 an opportunity to emulate the opcode.
72 <LI> The
"coprocessor not available" exception occurs if the program
73 contains instructions for a coprocessor, but no coprocessor is present
75 <LI> A coprocessor error is generated when a coprocessor detects an illegal
78 The instruction
<A HREF=
"INT.htm">INT
</A> generates an interrupt whenever it is executed; the
79 processor treats this interrupt as an exception. The effects of this
80 interrupt (and the effects of all other exceptions) are determined by
81 exception handler routines provided by the application program or as part of
82 the systems software (provided by systems programmers). The
83 <A HREF=
"INT.htm">INT
</A> instruction
84 itself is discussed in
85 <A HREF=
"c03.htm">Chapter
3</A>. Refer to
86 <A HREF=
"c09.htm">Chapter
9</A> for a more complete
87 description of exceptions.
89 Table
2-
2.
80386 Reserved Exceptions and Interrupts
91 Vector Number Description
97 4 <A HREF=
"INT.htm">INTO
</A> Detected Overflow
98 5 <A HREF=
"BOUND.htm">BOUND
</A> Range Exceeded
100 7 Coprocessor Not Available
102 9 Coprocessor Segment Overrun
103 10 Invalid Task State Segment
104 11 Segment Not Present
106 13 General Protection
115 <B>up:
</B> <A HREF=
"c02.htm">
116 Chapter
2 -- Basic Programming Model
</A><BR>
117 <B>prev:
</B> <A HREF=
"s02_05.htm">2.5 Operand Selection
</A><BR>
119 <A HREF=
"c03.htm">Chapter
3 -- Applications Instruction Set
</A><BR>