Precise exceptions
If exception at instruction I then
- Instructions I-1, I-2 etc complete normally
- Instructions I+1, I+2 etc. are restarted from scratch
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.