This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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
  • Further to that reply, note that in general instructions are atomic (there are a very few exceptions and branches are not one of them!) and are not interrupted when an exception occurs. So either the branch won't have started (in which case the exception handler will return to execute the branch) or it will have completed (in which case the next instruction will be the branch destination).

    I think it's also worth pointing out that branch instructions in the ARM architecture do not place anything on the stack. The return address is placed in the link register (LR, R14). Similarly, the processor doesn't automatically place anything on the stack when handling an exception. It uses LR and SPSR to store the return address and the processor state (of course, the handler may put these on the stack).

    (Unless you're using an ARMv7-M microcontroller core, in which case all of the APCS corruptible registers are automatically stacked on exception entry).

    Hope this helps.

    Chris

Reply
  • Further to that reply, note that in general instructions are atomic (there are a very few exceptions and branches are not one of them!) and are not interrupted when an exception occurs. So either the branch won't have started (in which case the exception handler will return to execute the branch) or it will have completed (in which case the next instruction will be the branch destination).

    I think it's also worth pointing out that branch instructions in the ARM architecture do not place anything on the stack. The return address is placed in the link register (LR, R14). Similarly, the processor doesn't automatically place anything on the stack when handling an exception. It uses LR and SPSR to store the return address and the processor state (of course, the handler may put these on the stack).

    (Unless you're using an ARMv7-M microcontroller core, in which case all of the APCS corruptible registers are automatically stacked on exception entry).

    Hope this helps.

    Chris

Children
No data