ARM exception and interrupt controller

This ARM tutorial covers ARM exception and interrupt controller. Refer following pages for other ARM tutorial contents.

ARM VECTOR TABLE

Exception/Interrupt Shorthand Address High Address
Reset RESET 0x00000000 0xffff0000
Undefined instruction UNDEF 0x00000004 0xffff0004
Software Interrupt SWI 0x00000008 0xffff0008
Prefetch abort PABT 0x0000000c 0xffff000c
Data abort DABT 0x00000010 0xffff0010
Reserved - 0x00000014 0xffff0014
Interrupt Request IRQ 0x00000018 0xffff0018
Fast Interrupt Request FIQ 0x0000001c 0xffff001c

RESET:

Happens when the processor powers up. Initializes the system, sets up stacks for different processor modes. Highest priority exception Upon entry into the reset handler the CPSR is in SVC mode and both IRQ and FIQ bits are set to 1, mask-ing any interrupts

DATA ABORT:

2nd highest priority. Happens when we try to read/write into an invalid address or access with the wrong access permission. Upon entry into the Data Abort Handler Up on entry into a Data Abort handler IRQ's will be disabled (I-bit set 1), and FIQ will be enabled IRQs are masked, but FIQs are kept unmasked.

FIQ:

Highest priority interrupt IRQ & FIQs are disabled till FIQ is handled.

IRQ:

2nd Highest priority interrupt IRQ handler is entered only is there is no FIQ & Data Abort on-going.

Pre-Fetch Abort:

Similar to data abort, but happens on address fetch failure. On entry to the handler, IRQs are disabled, but FIQs remain enabled and can happen during a Pre-Fetch abort.

simple interrupt system

SWI:

A Software Interrupt (SWI) exception occurs when the SWI instruction is executed and none of the other higher-priority exceptions have been flagged.

Undefined Instruction:

Undefined Instruction exception occurs when an instruction not in the ARM or Thumb instruction set reaches the execute stage of the pipeline and none of the other exceptions have been flagged Same priority as SWI as one can happen at a time. Meaning as the instruction being executed cannot both be an SWI instruction and an undefined instruction at the same time.

state diagram IRQ

ARM Exception handling

Following events happen when an exception happens:
• Store the CPSR to the SPSR of the exception mode.
• PC is stored in the LR of the exception mode.
• Link register is set to a specific address based on the current instruction.. For e.g. for ISR, LR = last executed instruction + 8
• Update the CPSR about the exception
• Set the PC to the address of the exception handler.

Similar posts on ARM

ARM tutorial page1
ARM tutorial page2
ARM tutorial page3
ARM tutorial page4
ARM tutorial page5
ARM tutorial page6