EXCEPTIONS
Control is the most challenging aspect of processor
design: it is both the hardest part to get
right and the hardest part to make fast. One of the hardest parts of control is
implementing exceptions and interrupts—events other than branches or jumps that
change the normal flow of instruction execution. An exception is an unexpected
event from within the processor; arithmetic overflow is an example of an
exception. An interrupt is an event that also causes an unexpected change in
control flow but comes from outside of the processor. Interrupts are used by
I/O devices to communicate with the processor.
Many
architectures and authors do not distinguish between interrupts and exceptions,
often using the older name interrupt to refer to both types of events. MIPS
convention uses the term exception to refer to any unexpected change in control
flow without distinguishing whether the cause is internal or external; we use
the term interrupt only when the event is externally caused.
The Intel IA-32
architecture uses the word interrupt for all these events. Interrupts were initially
created to handle unexpected events like arithmetic overflow and to signal
requests for service from I/O devices. The same basic mechanism was extended to
handle internally generated exceptions as well. Here are some examples showing
whether the situation is generated internally by the processor or externally
generated:
Type of event
·
I/O device request - External
·
Invoke the operating system from user
program - Internal
·
Arithmetic overflow - Internal
·
Using an undefined instruction -
Internal
·
Hardware malfunctions - Either
The operating system knows the reason for the
exception by the address at which it is initiated. The addresses are separated
by 32 bytes or 8 instructions, and the operating system must record the reason
for the exception and may perform some limited processing in this sequence.
When the exception is not vectored, a single entry point for all exceptions can
be used, and the operating system decodes the status register to find the
cause.
For the operating
system to handle the exception, it must know the reason for the exception, in
addition to the instruction that caused it. There are two main methods used to
communicate the reason for an exception. The method used in
the MIPS architecture is to include a status register (called the Cause register), which holds a field that indicates the reason for the exception. A second method is to use vectored interrupts. In a vectored interrupt, the address to which control is transferred is determined by the cause of the exception.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.