1
$\begingroup$

Say the CPU is currently handling an interrupt. Another interrupt arrives but it's lower priority than the current one so it gets put in the 'pending interrupt register'. My current interrupt is done so I use a 'return from exception' instruction. Where will this instruction jump to: the address which was interrupted, and then to the interrupt handler or will it immediatly jump to the handler of the new interrupt that is in the 'pending interrupt register'?

$\endgroup$
1
$\begingroup$

What happens internally inside the processor could go either way depending on how the designers chose to implement it. Either you are returning to the address that was interrupted, but it immediately gets interrupted again, in which case the next instruction that executes is the first instruction of the next handler, or you are jumping directory to the first instruction of the next handler.

In either case: the first instruction of the next handler will be executed before the instruction that was originally interrupted. Anything else would be a priority inversion bug.

$\endgroup$
  • $\begingroup$ Nice answer, some examples for common CPU architectures in the answer would be nicer still. And references of course; refs are always nice (I'm not original poster). $\endgroup$ – Maarten Bodewes Feb 3 '15 at 17:19
  • $\begingroup$ I don't understand "the first instruction of the next handler will be executed before the instruction that was originally interrupted." Hasn't the original instruction finished execution already and a return from exception jumps to the next instruction following that? $\endgroup$ – model world Feb 3 '15 at 17:26
  • $\begingroup$ @modelworld, by "the instruction that was originally interrupted" I meant the same thing as in your question where you said "the address which was interrupted." $\endgroup$ – Wandering Logic Feb 3 '15 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.