Precise exceptions
If exception at instruction i then
- Instructions i-1, i-2 etc complete normally (flush the pipe)
- Instructions i+1, i+2 etc. already in the pipeline will be “no-oped” and will be restarted from scratch after the exception has been handled
Handling precise exceptions: Basic idea
- Force a trap instruction on the next IF
- Turn off writes for all instructions i and following
- When the target of the trap instruction receives control, it saves the PC of the instruction having the exception
- After the exception has been handled, an instruction “return from trap” will restore the PC.