Home | Projects | Notes > Computer Architecture & Organization > Privileged Mode and Exceptions

Privileged Mode and Exceptions

 

Interrupts and Exceptions

 

Current Program Status Register (See the "mode")

 

cpsr

 

 

the-arm-processors-banked-register-set

 

 

Specific ARM Exception Handling Sequence

  1. The operating mode is changed to the mode corresponding to the exception.

    • e.g., An interrupt request would select IRQ mode.

  2. The address of the instruction following the point at which the exception occurred is copied into register r14 (lr).

    • In other words, the exception is treated as a type of subroutine call and the return address is preserved in the link register.

  3. The current value of the CPSR is saved in the SPSR of the new mode.

    • e.g., If the exception is an interrupt request, CPSR gets saved in SPSR_irq.

    • It is necessary to save the current processor status because an exception must not be allowed to modify the processor status.

  4. Interrupt requests are disabled by setting bit 7 of the CPSR.

    • If the current exception is a fast interrupt request, further FIQ exceptions are disabled by setting bit 6 of the CPSR.

  5. Each location in the exception table contains an instruction that is executed first in the exception handling routine.

    • This instruction is normally a branch operation (for example B myHandler)

    • This would load the program counter with the address of the corresponding current exception handler.

 

Returning From an Exception