patternMinor
Clear interrupt instruction in a pipelined CPU
Viewed 0 times
pipelinedinterruptinstructionclearcpu
Problem
Say you execute a clear interrupt instruction (CLI) in a pipelined CPU. While that instruction is being fetched, an interrupt occurs, so the instruction after the CLI is from the interrupt handler.
You excepted no interrupts because of the CLI instruction but you still got one. How is this problem solved?
You excepted no interrupts because of the CLI instruction but you still got one. How is this problem solved?
Solution
Such a control hazard can be handled effectively the same way that a branch misprediction is handled. Either the CLI instruction commits and the interrupt handler fetch is treated as the mispredicted path and fetch is restarted after the CLI or the CLI instruction is not committed and the interrupt handler is treated as the correct path.
Context
StackExchange Computer Science Q#45299, answer score: 4
Revisions (0)
No revisions yet.