SlideShare a Scribd company logo
ARM EXCEPTIONS &
ARM INTERRUPT CONTROLLER
1
Submitted by:- MAHIMA SHASTRI
Enrollment no. :- 170050111022
2
EXCEPTION
Condition that needs to halt the normal sequential execution of
instructions
Mapping exceptions to modes
3
Figure: ARM Vectortable
Exception Priority:
• B<address> provides a branch relative from the pc.
• LDR pc, [pc, #offset]—This load register instruction
loads the handler address from memory to the pc.
• LDR pc, [pc, #-0xff0]—This load register instruction
loads a specific interrupt service routine address from
address 0xfffff030 to the pc.
• MOV pc, #immediate—This move instruction copies
an immediate value into the pc. MOV pc, #immediate
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, masking any interrupts
DATAABORT:
2n
d
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,
IRQ’s will be disabled (I-bit set 1), and FIQ
will be enabled (F-bit set 0).
FIQ:
Highest priority interrupt
 IRQ & FIQs are disabled till FIQ is handled. 5
6
IRQ:
2nd Highest priorityinterrupt
IRQ handler is entered only if there
is no FIQ & Data Abort on-going.
Undefined Instruction:
Undefined Instruction exception occurs
when an instruction not in the ARM orThumb
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.
Pre-FetchAbort:
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.
SWI:
A Software Interrupt (SWI) exception
occurs when the SWI instruction is
executed and none of the other higher-
priority exceptions have been flagged.
• saves the cpsr to the spsr of the exception mode
• saves the pc to the lr of the exception mode
• sets the cpsr to the exception mode
• sets pc to the address of the exception handler
CPSR
LR.exp
SPSR.exp
PC PC
CPSR
User mode Exception mode
ARM EXCEPTION
HANDLING
Return from Exception:
8
LOCATING THE OFFENDING
INSTRUCTION:
This example shows that a typical method of
returning from an IRQ and FIQ handler is to
use a SUBS instruction:
handler
<handler code>
...
SUBS pc, r14, #4 ; pc=r14-4
Because there is an S at the end of the SUB
instruction and the pc is the destination register,
the cpsr is automatically restored from the spsr
register.
This example shows another method that
subtracts the offset from the link register r14 at
the beginning of the handler.
handler
SUB r14, r14, #4 ; r14-=4
...
<handler code>
...
MOVS pc, r14 ; return
After servicing is complete, return to normal
execution occurs by moving the link register r14
into the pc and restoring cpsr from the spsr.
The final example uses the interrupt stack to store the link register. This method first
subtracts an offset from the link register and then stores it onto the interrupt stack.
handler
SUB r14, r14, #4 ; r14-=4
STMFD r13!,{r0-r3, r14} ; store context
...
<handler code>
...
LDMFD r13!,{r0-r3, pc}ˆ ; return
To return to normal execution, the LDM instruction is used to load the pc. The ˆ
symbol in the instruction forces the cpsr to be restored from the spsr.
ARM INTERRUPT
HANDLING
11
Interrupts
SWI instructionIRQ and FIQ
• Software Interrupts are normally reserved to call privileged operating system routines.
Eg: Change a program running in user mode to a privileged mode.
• Interrupt Requests are normally assigned for general-purpose interrupts.
IRQ exception has a lower priority and higher interrupt latency
• Fast Interrupt Requests are normally reserved for a single interrupt source that requires a
fast response time
The interval of time from an external interrupt request signal being raised to the first
fetch of an instruction of a specific interrupt service routine (ISR).
Two main methods to minimize interrupt
latency
• use a nested interrupt handler -
achieved by re-enabling the interrupts as
soon as the interrupt source has been
serviced but before the interrupt handling
is complete.
• Prioritization - ignore interrupts of the
same or lower priority than the interrupt
you are handling, so only a higher-priority
task can interrupt your handler.
INTERRUPT LATENCY
• When an IRQ occurs, the processor moves into state 2.
• Sets the IRQ =1, disabling any further IRQ exceptions.
• FIQ has a higher priority and therefore doesn't get disabled
when a low-priority IRQ exception is raised.
• The cpsr processor mode changes to IRQ mode.
• spsr_irq = cpsr.
• PC = r14_irq.
• pc = IRQ entry +0x18 in the vector table.
• In state 3 the software handler takes over
• Upon completion, the processor mode reverts back to the
original user mode code in state 1.
INTERRUPT
REQUEST IRQ
Figure: State-Machine for an IRQ
INTERRUPT
REQUEST FIQ
• When an FIQ occurs, the processor moves into state 2.
• Sets the IRQ =1 and FIQ =1, disabling any further IRQ and
FIQ exceptions.
• The cpsr processor mode changes to FIQ mode.
• No need to save registers r8 to r12
• spsr_fiq = cpsr.
• r14_fiq = pc.
• pc = FIQ entry +0x1C in the vector table.
• In state 3 the software handler takes over
• Upon completion, the processor mode reverts back to the original user mode code in state 1.
• FIQ is ideal for servicing a single-source, high-priority, low-latency interrupt.
The immediate value on the data
processing BIC or ORR instruction
has to be changed to 0xc0 to enable
or disable both interrupts.
STACK MEMORY
LAYOUT
The main advantage of layout B over A is that B does not corrupt
the vector table when a stack overflow occurs, and so the system
has a chance to correct itself when an overflow has been identified.
Supervisor mode stack
LDR r13, SVC_NewStack ; r13_svc
...
SVC_NewStack
DCD SVC_Stack
IRQ mode stack
MOV r2, #NoInt|IRQ32md
MSR cpsr_c, r2
LDR r13, IRQ_NewStack ; r13_irq
...
IRQ_NewStack
DCD IRQ_Stack
NOINT EQU 0XC0 ; DISABLE
INTERRUPT
User mode stack
MOV r2, #Sys32md
MSR cpsr_c, r2
LDR r13, USR_NewStack ; r13_usr
...
USR_NewStack
DCD USR_Stack
NON-NESTED
INTERRUPT HANDLER• The interrupts are disabled until control is returned back to
the interrupted task or process.
• Can service only a single interrupt at a time.
1. Disable interrupt/s—When the IRQ exception is raised, theARM
processor will disable further IRQ exceptions from occurring.
2.Save context—On entry the handler code saves a subset of the
current processor mode non banked registers.
3.Interrupt handler—The handler then identifies the external interrupt
source and executes the appropriate interrupt service routine (ISR).
4.Interrupt service routine—The ISR services the external interrupt
source and resets the interrupt.
5.Restore context—The ISR returns back to the interrupt handler,
which restores the context.
6. Enable interrupts— pc = lr−4 cpsr = spsr_{mode}
WHAT HAPPENS WHEN AN EXCEPTION
HAPPENS?
1.Store the CPSR to the SPSR of the exception mode.
2.PC is stored in the LR of the exception mode.
3.Link register is set to a specific address based on the current
instruction..
• For e.g. for ISR, LR = last executed instruction + 8
4. Update the CPSR about the exception
5. Set the PC to the address of the exception handler.
19

More Related Content

What's hot

Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWERMastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
FastBit Embedded Brain Academy
 
Wcdma Rno Handover Algorithm Analysis And Parameter Configurtaion Guidance 20...
Wcdma Rno Handover Algorithm Analysis And Parameter Configurtaion Guidance 20...Wcdma Rno Handover Algorithm Analysis And Parameter Configurtaion Guidance 20...
Wcdma Rno Handover Algorithm Analysis And Parameter Configurtaion Guidance 20...
guest42b2673
 
Arm architecture
Arm architectureArm architecture
Arm architecture
MinYeop Na
 
Timing Generators and ClockCleaner Solutions
Timing Generators and ClockCleaner SolutionsTiming Generators and ClockCleaner Solutions
Timing Generators and ClockCleaner Solutions
Premier Farnell
 
Exception handling in Pipelining in COA
Exception handling in Pipelining in COAException handling in Pipelining in COA
Exception handling in Pipelining in COA
RishavChandel1
 
Interrupt handling
Interrupt handlingInterrupt handling
Interrupt handling
maverick2203
 
Arm7 architecture
Arm7 architectureArm7 architecture
Arm7 architecture
Syeda Nasiha
 
Arm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_modelArm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_model
Ganesh Naik
 
ARM
ARMARM
Arm architecture
Arm architectureArm architecture
arm-cortex-a8
arm-cortex-a8arm-cortex-a8
arm-cortex-a8
Andrew Daws
 
8259
8259 8259
STM32 Microcontroller Clocks and RCC block
STM32 Microcontroller Clocks and RCC blockSTM32 Microcontroller Clocks and RCC block
STM32 Microcontroller Clocks and RCC block
FastBit Embedded Brain Academy
 
Arm programmer's model
Arm programmer's modelArm programmer's model
Arm programmer's model
v Kalairajan
 
The ARM Architecture: ARM : ARM Architecture
The ARM Architecture: ARM : ARM ArchitectureThe ARM Architecture: ARM : ARM Architecture
The ARM Architecture: ARM : ARM Architecture
sreea4
 
Arm
ArmArm
Architectural support for High Level Language
Architectural support for High Level LanguageArchitectural support for High Level Language
Architectural support for High Level Language
Sudhanshu Janwadkar
 
Arm architecture
Arm architectureArm architecture
Arm architecture
AAQIB PARREY
 
W10: Interrupts
W10: InterruptsW10: Interrupts
W10: Interrupts
Daniel Roggen
 
ARM Processor
ARM ProcessorARM Processor
ARM Processor
Aniket Thakur
 

What's hot (20)

Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWERMastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
 
Wcdma Rno Handover Algorithm Analysis And Parameter Configurtaion Guidance 20...
Wcdma Rno Handover Algorithm Analysis And Parameter Configurtaion Guidance 20...Wcdma Rno Handover Algorithm Analysis And Parameter Configurtaion Guidance 20...
Wcdma Rno Handover Algorithm Analysis And Parameter Configurtaion Guidance 20...
 
Arm architecture
Arm architectureArm architecture
Arm architecture
 
Timing Generators and ClockCleaner Solutions
Timing Generators and ClockCleaner SolutionsTiming Generators and ClockCleaner Solutions
Timing Generators and ClockCleaner Solutions
 
Exception handling in Pipelining in COA
Exception handling in Pipelining in COAException handling in Pipelining in COA
Exception handling in Pipelining in COA
 
Interrupt handling
Interrupt handlingInterrupt handling
Interrupt handling
 
Arm7 architecture
Arm7 architectureArm7 architecture
Arm7 architecture
 
Arm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_modelArm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_model
 
ARM
ARMARM
ARM
 
Arm architecture
Arm architectureArm architecture
Arm architecture
 
arm-cortex-a8
arm-cortex-a8arm-cortex-a8
arm-cortex-a8
 
8259
8259 8259
8259
 
STM32 Microcontroller Clocks and RCC block
STM32 Microcontroller Clocks and RCC blockSTM32 Microcontroller Clocks and RCC block
STM32 Microcontroller Clocks and RCC block
 
Arm programmer's model
Arm programmer's modelArm programmer's model
Arm programmer's model
 
The ARM Architecture: ARM : ARM Architecture
The ARM Architecture: ARM : ARM ArchitectureThe ARM Architecture: ARM : ARM Architecture
The ARM Architecture: ARM : ARM Architecture
 
Arm
ArmArm
Arm
 
Architectural support for High Level Language
Architectural support for High Level LanguageArchitectural support for High Level Language
Architectural support for High Level Language
 
Arm architecture
Arm architectureArm architecture
Arm architecture
 
W10: Interrupts
W10: InterruptsW10: Interrupts
W10: Interrupts
 
ARM Processor
ARM ProcessorARM Processor
ARM Processor
 

Similar to ARM exceptions and interrupt controls

Arm architecture overview
Arm architecture overviewArm architecture overview
Arm architecture overview
Sathish Arumugasamy
 
WINSEM2022-23_BECE204L_TH_VL2022230500861_2023-02-10_Reference-Material-I.pptx
WINSEM2022-23_BECE204L_TH_VL2022230500861_2023-02-10_Reference-Material-I.pptxWINSEM2022-23_BECE204L_TH_VL2022230500861_2023-02-10_Reference-Material-I.pptx
WINSEM2022-23_BECE204L_TH_VL2022230500861_2023-02-10_Reference-Material-I.pptx
SoniBhavya
 
8259 Programmable Interrupt Controller.pptx
8259 Programmable Interrupt Controller.pptx8259 Programmable Interrupt Controller.pptx
8259 Programmable Interrupt Controller.pptx
tchandoo1
 
ARM7TDMI-S_CPU.ppt
ARM7TDMI-S_CPU.pptARM7TDMI-S_CPU.ppt
ARM7TDMI-S_CPU.ppt
MostafaParvin1
 
LPC 2148 Instructions Set.ppt
LPC 2148 Instructions Set.pptLPC 2148 Instructions Set.ppt
LPC 2148 Instructions Set.ppt
ProfBadariNathK
 
ARM - Advance RISC Machine
ARM - Advance RISC MachineARM - Advance RISC Machine
ARM - Advance RISC Machine
EdutechLearners
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
MostafaParvin1
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
baskarA13
 
arm
armarm
Introduction to ARM Architecture
Introduction to ARM ArchitectureIntroduction to ARM Architecture
Introduction to ARM Architecture
Racharla Rohit Varma
 
ESD_05_ARM_Instructions set for preparation
ESD_05_ARM_Instructions set for preparationESD_05_ARM_Instructions set for preparation
ESD_05_ARM_Instructions set for preparation
ssuser026e94
 
Lect 3 ARM PROCESSOR ARCHITECTURE
Lect 3  ARM PROCESSOR ARCHITECTURE Lect 3  ARM PROCESSOR ARCHITECTURE
Lect 3 ARM PROCESSOR ARCHITECTURE
Dr.YNM
 
Programming ARM Cortex-M4 STM32 Nucleo
Programming ARM Cortex-M4  STM32 NucleoProgramming ARM Cortex-M4  STM32 Nucleo
Programming ARM Cortex-M4 STM32 Nucleo
Sanjay Adhikari
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
National Cheng Kung University
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
John Williams
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
Nilesh Bhandare
 
pic_1.pdf
pic_1.pdfpic_1.pdf
pic_1.pdf
ZatinGupta2
 
Interrupts.ppt
Interrupts.pptInterrupts.ppt
Interrupts.ppt
SasiBhushan22
 
CPU.ppd
CPU.ppdCPU.ppd
Lecture on PIC-1.pptx
Lecture on PIC-1.pptxLecture on PIC-1.pptx
Lecture on PIC-1.pptx
godfrey35
 

Similar to ARM exceptions and interrupt controls (20)

Arm architecture overview
Arm architecture overviewArm architecture overview
Arm architecture overview
 
WINSEM2022-23_BECE204L_TH_VL2022230500861_2023-02-10_Reference-Material-I.pptx
WINSEM2022-23_BECE204L_TH_VL2022230500861_2023-02-10_Reference-Material-I.pptxWINSEM2022-23_BECE204L_TH_VL2022230500861_2023-02-10_Reference-Material-I.pptx
WINSEM2022-23_BECE204L_TH_VL2022230500861_2023-02-10_Reference-Material-I.pptx
 
8259 Programmable Interrupt Controller.pptx
8259 Programmable Interrupt Controller.pptx8259 Programmable Interrupt Controller.pptx
8259 Programmable Interrupt Controller.pptx
 
ARM7TDMI-S_CPU.ppt
ARM7TDMI-S_CPU.pptARM7TDMI-S_CPU.ppt
ARM7TDMI-S_CPU.ppt
 
LPC 2148 Instructions Set.ppt
LPC 2148 Instructions Set.pptLPC 2148 Instructions Set.ppt
LPC 2148 Instructions Set.ppt
 
ARM - Advance RISC Machine
ARM - Advance RISC MachineARM - Advance RISC Machine
ARM - Advance RISC Machine
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
 
arm
armarm
arm
 
Introduction to ARM Architecture
Introduction to ARM ArchitectureIntroduction to ARM Architecture
Introduction to ARM Architecture
 
ESD_05_ARM_Instructions set for preparation
ESD_05_ARM_Instructions set for preparationESD_05_ARM_Instructions set for preparation
ESD_05_ARM_Instructions set for preparation
 
Lect 3 ARM PROCESSOR ARCHITECTURE
Lect 3  ARM PROCESSOR ARCHITECTURE Lect 3  ARM PROCESSOR ARCHITECTURE
Lect 3 ARM PROCESSOR ARCHITECTURE
 
Programming ARM Cortex-M4 STM32 Nucleo
Programming ARM Cortex-M4  STM32 NucleoProgramming ARM Cortex-M4  STM32 Nucleo
Programming ARM Cortex-M4 STM32 Nucleo
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
pic_1.pdf
pic_1.pdfpic_1.pdf
pic_1.pdf
 
Interrupts.ppt
Interrupts.pptInterrupts.ppt
Interrupts.ppt
 
CPU.ppd
CPU.ppdCPU.ppd
CPU.ppd
 
Lecture on PIC-1.pptx
Lecture on PIC-1.pptxLecture on PIC-1.pptx
Lecture on PIC-1.pptx
 

Recently uploaded

Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
john krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptxjohn krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptx
Madan Karki
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
amsjournal
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 

Recently uploaded (20)

Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
john krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptxjohn krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptx
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 

ARM exceptions and interrupt controls

  • 1. ARM EXCEPTIONS & ARM INTERRUPT CONTROLLER 1 Submitted by:- MAHIMA SHASTRI Enrollment no. :- 170050111022
  • 2. 2 EXCEPTION Condition that needs to halt the normal sequential execution of instructions Mapping exceptions to modes
  • 4. • B<address> provides a branch relative from the pc. • LDR pc, [pc, #offset]—This load register instruction loads the handler address from memory to the pc. • LDR pc, [pc, #-0xff0]—This load register instruction loads a specific interrupt service routine address from address 0xfffff030 to the pc. • MOV pc, #immediate—This move instruction copies an immediate value into the pc. MOV pc, #immediate
  • 5. 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, masking any interrupts DATAABORT: 2n d 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, IRQ’s will be disabled (I-bit set 1), and FIQ will be enabled (F-bit set 0). FIQ: Highest priority interrupt  IRQ & FIQs are disabled till FIQ is handled. 5
  • 6. 6 IRQ: 2nd Highest priorityinterrupt IRQ handler is entered only if there is no FIQ & Data Abort on-going. Undefined Instruction: Undefined Instruction exception occurs when an instruction not in the ARM orThumb 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. Pre-FetchAbort: 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. SWI: A Software Interrupt (SWI) exception occurs when the SWI instruction is executed and none of the other higher- priority exceptions have been flagged.
  • 7. • saves the cpsr to the spsr of the exception mode • saves the pc to the lr of the exception mode • sets the cpsr to the exception mode • sets pc to the address of the exception handler CPSR LR.exp SPSR.exp PC PC CPSR User mode Exception mode ARM EXCEPTION HANDLING Return from Exception:
  • 9. This example shows that a typical method of returning from an IRQ and FIQ handler is to use a SUBS instruction: handler <handler code> ... SUBS pc, r14, #4 ; pc=r14-4 Because there is an S at the end of the SUB instruction and the pc is the destination register, the cpsr is automatically restored from the spsr register. This example shows another method that subtracts the offset from the link register r14 at the beginning of the handler. handler SUB r14, r14, #4 ; r14-=4 ... <handler code> ... MOVS pc, r14 ; return After servicing is complete, return to normal execution occurs by moving the link register r14 into the pc and restoring cpsr from the spsr.
  • 10. The final example uses the interrupt stack to store the link register. This method first subtracts an offset from the link register and then stores it onto the interrupt stack. handler SUB r14, r14, #4 ; r14-=4 STMFD r13!,{r0-r3, r14} ; store context ... <handler code> ... LDMFD r13!,{r0-r3, pc}ˆ ; return To return to normal execution, the LDM instruction is used to load the pc. The ˆ symbol in the instruction forces the cpsr to be restored from the spsr.
  • 11. ARM INTERRUPT HANDLING 11 Interrupts SWI instructionIRQ and FIQ • Software Interrupts are normally reserved to call privileged operating system routines. Eg: Change a program running in user mode to a privileged mode. • Interrupt Requests are normally assigned for general-purpose interrupts. IRQ exception has a lower priority and higher interrupt latency • Fast Interrupt Requests are normally reserved for a single interrupt source that requires a fast response time
  • 12. The interval of time from an external interrupt request signal being raised to the first fetch of an instruction of a specific interrupt service routine (ISR). Two main methods to minimize interrupt latency • use a nested interrupt handler - achieved by re-enabling the interrupts as soon as the interrupt source has been serviced but before the interrupt handling is complete. • Prioritization - ignore interrupts of the same or lower priority than the interrupt you are handling, so only a higher-priority task can interrupt your handler. INTERRUPT LATENCY
  • 13. • When an IRQ occurs, the processor moves into state 2. • Sets the IRQ =1, disabling any further IRQ exceptions. • FIQ has a higher priority and therefore doesn't get disabled when a low-priority IRQ exception is raised. • The cpsr processor mode changes to IRQ mode. • spsr_irq = cpsr. • PC = r14_irq. • pc = IRQ entry +0x18 in the vector table. • In state 3 the software handler takes over • Upon completion, the processor mode reverts back to the original user mode code in state 1. INTERRUPT REQUEST IRQ Figure: State-Machine for an IRQ
  • 14. INTERRUPT REQUEST FIQ • When an FIQ occurs, the processor moves into state 2. • Sets the IRQ =1 and FIQ =1, disabling any further IRQ and FIQ exceptions. • The cpsr processor mode changes to FIQ mode. • No need to save registers r8 to r12 • spsr_fiq = cpsr. • r14_fiq = pc. • pc = FIQ entry +0x1C in the vector table. • In state 3 the software handler takes over • Upon completion, the processor mode reverts back to the original user mode code in state 1. • FIQ is ideal for servicing a single-source, high-priority, low-latency interrupt.
  • 15. The immediate value on the data processing BIC or ORR instruction has to be changed to 0xc0 to enable or disable both interrupts.
  • 16. STACK MEMORY LAYOUT The main advantage of layout B over A is that B does not corrupt the vector table when a stack overflow occurs, and so the system has a chance to correct itself when an overflow has been identified.
  • 17. Supervisor mode stack LDR r13, SVC_NewStack ; r13_svc ... SVC_NewStack DCD SVC_Stack IRQ mode stack MOV r2, #NoInt|IRQ32md MSR cpsr_c, r2 LDR r13, IRQ_NewStack ; r13_irq ... IRQ_NewStack DCD IRQ_Stack NOINT EQU 0XC0 ; DISABLE INTERRUPT User mode stack MOV r2, #Sys32md MSR cpsr_c, r2 LDR r13, USR_NewStack ; r13_usr ... USR_NewStack DCD USR_Stack
  • 18. NON-NESTED INTERRUPT HANDLER• The interrupts are disabled until control is returned back to the interrupted task or process. • Can service only a single interrupt at a time. 1. Disable interrupt/s—When the IRQ exception is raised, theARM processor will disable further IRQ exceptions from occurring. 2.Save context—On entry the handler code saves a subset of the current processor mode non banked registers. 3.Interrupt handler—The handler then identifies the external interrupt source and executes the appropriate interrupt service routine (ISR). 4.Interrupt service routine—The ISR services the external interrupt source and resets the interrupt. 5.Restore context—The ISR returns back to the interrupt handler, which restores the context. 6. Enable interrupts— pc = lr−4 cpsr = spsr_{mode}
  • 19. WHAT HAPPENS WHEN AN EXCEPTION HAPPENS? 1.Store the CPSR to the SPSR of the exception mode. 2.PC is stored in the LR of the exception mode. 3.Link register is set to a specific address based on the current instruction.. • For e.g. for ISR, LR = last executed instruction + 8 4. Update the CPSR about the exception 5. Set the PC to the address of the exception handler. 19