Wikipedia has a perfect definition about interrupt:
“In system programming, an interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. An interrupt alerts the processor to a high-priority condition requiring the interruption of the current code the processor is executing…”
There are several ways to categorize interrupts, among which the most important one is precise interrupt and imprecise interrupt.
We will discuss the definition about precise interrupt in this post, based on J.E. Smith and A.R. Pleszkun’s paper Implementing Precise Interrupt in Pipelined Processor.
The Definition of Precise Interrupt
A precise interrupt should leave the machine in a well-defined state. The order of instruction execution should be well maintained during precise interrupt handling.
To be more specific, precise interrupt handling needs to meet the following requirement:
- The program counter / PC is saved in a known place
- All instructions before the one pointed to by PC have been fully executed and changed the machine state
- No instructions beyond the one pointed to by PC has been executed or changed the machine state
- The execution state of the instruction pointed to by PC is known
Obviously, an imprecise interrupt is the one that does not satisfy all requirements above.
Understanding the definition of precise interrupt is critical for implementing precise interrupt in pipelined processors. In next post, we cover how to implement precise interrupts.