Question Related to Interrupts

Question:  When a processor is interrupted when it is executing a Jump instruction, what goes on the stack - the address of the instruction next to jump or the address where the jump is supposed to go."

Parents
  • The old address after an interrupt is always such that a return from the interrupt will resume execution correctly. Therefore the address should be either the start of the jump and the jump is redone or the place it is going to. However in 32 bit ARM and Thumb the old address is at an offset beyond that point dependent on the interrupt type, and the offset has to be subtracted before returning - except for SVC where you want to return to just after the SVC anyway. If you see an address after the jump it is because the jump wasn't executed and the return sequence will subtract an instruction size to do the jump. I believe this business about the offset is a relic of the earliest ARM chips where they saved a bit of circuitry by using the PC where the instruction decoder had currently got to rather than a more logical value. Thankfully it all goes away in the 64 bit ARMs.

Reply
  • The old address after an interrupt is always such that a return from the interrupt will resume execution correctly. Therefore the address should be either the start of the jump and the jump is redone or the place it is going to. However in 32 bit ARM and Thumb the old address is at an offset beyond that point dependent on the interrupt type, and the offset has to be subtracted before returning - except for SVC where you want to return to just after the SVC anyway. If you see an address after the jump it is because the jump wasn't executed and the return sequence will subtract an instruction size to do the jump. I believe this business about the offset is a relic of the earliest ARM chips where they saved a bit of circuitry by using the PC where the instruction decoder had currently got to rather than a more logical value. Thankfully it all goes away in the 64 bit ARMs.

Children
More questions in this forum