SlideShare una empresa de Scribd logo
1 de 56
SOFTWARE & SYSTEMS
DESIGN
2 - Architecture
AGENDA
• Introduction to ARM and the Architecture
Processor Families
Programmer’s Model
AAETC2v00
Architecture 2
Programmer’s Model
Exceptions and Interrupts
ARM LTD
• ARM founded in November 1990
– Advanced RISC Machines
• Company headquarters in Cambridge, UK
– Processor design centers in Cambridge, Austin, and Sophia
Antipolis
– Sales, support, and engineering offices all over the world
• Best known for its range of RISC processor cores designs
AAETC2v00
Architecture 3
• Best known for its range of RISC processor cores designs
– Other products – fabric IP, software tools, models, cell libraries -
to help partners develop and ship ARM-based SoCs
• ARM does not manufacture silicon
• More information about ARM and our offices on their
web site:
– http://www.arm.com/aboutarm/
On chip
EXAMPLE ARM-BASED SYSTEM
• ARM core deeply embedded within an
SoC
– External debug and trace via JTAG or
CoreSight interface
• Design can have both external and
internal memories
– Varying width, speed and size –
depending on system requirements
ARM
Processor
core
AMBAAXI
External
Memory
Interface
DMA
Port
Clocks and
Reset Controller
DEBUG
nIRQ
nFIQ
FLASH
SDRAM
AAETC2v00
Architecture 4
memory
depending on system requirements
• Can include ARM licensed CoreLink
peripherals
– Interrupt controller, since core only
has two interrupt sources
– Other peripherals and interfaces
• Can include on-chip memory from
ARM Artisan Physical IP Libraries
• Elements connected using AMBA
(Advanced Microcontroller Bus
Architecture)
APB
Bridge
AMBAAPB
CoreLink
Interrupt
Controller
Other
CoreLink
Peripherals
nFIQ
ARM based
SoC
Custom
Peripherals
VERSIONS AND IMPLEMENTATIONS
AAETC2v00
Architecture 5
EMBEDDED PROCESSORS
AAETC2v00
Architecture 6
APPLICATION PROCESSORS
AAETC2v00
Architecture 7
ARCHITECTURE EVOLUTION
AAETC2v00
Architecture 8
• Compatibility
• Backward compatibility
• ARMv6 code cannot be guaranteed to run on a ARMv5
processor but will run on a ARMv7 processor
ARCHITECTURE ARMV7 PROFILES
• Application profile (ARMv7-A)
– Memory management support (MMU)
– Highest performance at low power
• Influenced by multi-tasking OS system requirements
– TrustZone and Jazelle-RCT for a safe, extensible system
– e.g. Cortex-A5, Cortex-A9
• Real-time profile (ARMv7-R)
AAETC2v00
Architecture 9
• Real-time profile (ARMv7-R)
– Protected memory (MPU)
– Low latency and predictability ‘real-time’ needs
– Evolutionary path for traditional embedded business
– e.g. Cortex-R4
• Microcontroller profile (ARMv7-M, ARMv7E-M, ARMv6-M)
– Lowest gate count entry point
– Deterministic and predictable behavior a key priority
– Deeply embedded use
– e.g. Cortex-M3
TRUSTZONE SECURITY EXTENSIONS
• Extensions added for ARM1176, and for all V7-A cores
• Application is divided into “Secure” and “Non-Secure” worlds
• New “Secure Monitor” exception mode
• Secure Monitor exception handling code acts as a gatekeeper for moving between
worlds.
• Separate exception tables for secure and non secure worlds
• Memory (on-chip, caches, and TCMS) can be marked for secure access only
• Debug for secure world code and data restricted
Secure WorldNormal World System Boot
AAETC2v00
Architecture 10
Secure World
Secure
Kernel
Normal World
Secure
Monitor
Secure service
Platform
OS
User mode
Privileged mode
User mode
Privileged mode
Process
LPAE
• The Large Physical Address Extensions (LPAE) is an optional extension to
ARMv7-A
– Supported by Cortex-A15 and Cortex-A7
• LPAE provides:
– New translation table format - Long-descriptor Format
– 32-bit virtual addresses, with 40-bit physical address
– Can still use (existing) Short-descriptor page table format
AAETC2v00
Architecture 11
– Can still use (existing) Short-descriptor page table format
32-bit virtual address space
40-bit physical address space
• New Privileged Execute Never (PXN) attribute
• New hierarchical attributes (XNTable, PXNTable, NSTable and APTable)
ARMV7-A VIRTUALIZATION
EXTENSIONS
• ARMv7-A has an optional virtualization extension
– Implemented by the Cortex-A15 and Cortex-A7
• Provides hardware support for “full” virtualization
– In the Normal world only, no virtualization support in the Secure world
Secure worldNormal world
AAETC2v00
Architecture 12
Guest OS
Hypervisor
Trusted OS
Trusted Service(s)
Secure Monitor
Application(s)
Guest OS
Application(s)PL0
PL1
PL2
WHICH ARCHITECTURE IS MY
PROCESSOR?
AAETC2v00
Architecture 13
AGENDA
Introduction to ARM and the Architecture
• Processor Families
Programmer’s Model
AAETC2v00
Architecture 14
Programmer’s Model
Exceptions and Interrupts
ARM7TDMI PROCESSOR
• 3-stage pipeline
• on Neumann architecture
– Single instruction and data
memory interface
• T D M I =
T Thumb instruction set support
AAETC2v00
Architecture 15
D Debug support
M Enhanced multiplier (32x8) with
instructions for 64-bit results
I Embedded ICE Logic
• ARM7TDMI-S - synthesizable
version of the ARM7TDMI
– Instruction Set and Cycle
compatible with ARM7TDMI
Hard Macrocell
– Single Clock Design (rising edge)
– Simplified Bus Interface
ARM9TDMI PROCESSOR FAMILY
• 5-stage pipeline
– Improved maximum clock frequency
• Harvard architecture
– Separate instruction and data
interface
– Simultaneous instruction and data
access
• Normally supplied with caches
AAETC2v00
Architecture 16
• Normally supplied with caches
attached
• ARM920T
– 2 x 16K caches
– Memory Management Unit (MMU)
– Write Buffer
• ARM922T (pictured)
– Same as ARM922T but with 2 x 8K
caches
• ARM940T
– Memory Protection Unit (MPU)
ARM926EJ-S PROCESSOR
• Based on the ARM9-E core
• 5-stage pipeline (similar to ARM9TDMI)
• Configurable Instruction and Data
caches
• Configurable Instruction and Data
AAETC2v00
Architecture 17
• Configurable Instruction and Data
TCMs
• AHB bus interface
• Memory Management Unit
• Jazelle DBX support
– Can execute some Java bytecodes in
hardware
ARM1176JZ(F)-S PROCESSOR
• ARM1176JZ(F)-S
– Architecture v6Z - TrustZone
– 8-stage pipeline
• Load/Store Unit separate
from ALU
• Static and dynamic branch
prediction
– Physically-tagged 4-64k caches
– Dual configurable TCMs
AAETC2v00
Architecture 18
– Dual configurable TCMs
– Memory management unit
– Four AXI memory ports
– Jazelle-DBX support
– Optional integrated VFP
coprocessor
• ARM1136J(F)-S (not shown here)
– AHB memory interface
– No TrustZone support
– Single TCMs
ARM1156T2(F)-S PROCESSOR
• ARM1156T2(F)-S
– Architecture v6T2 – Thumb-2
support
• Core can run completely in
Thumb state (including
exceptions)
– 9-stage pipeline
• Load/Store Unit separate
from ALU
AAETC2v00
Architecture 19
from ALU
• Static and dynamic branch
prediction
– Physically-tagged 4-64k caches
– Configurable TCMs
– Memory protection unit
– Three AXI memory ports
– Optional integrated vectored
interrupt controller port
– Optional integrated VFP
coprocessor
ARM11 MPCORE PROCESSOR
• Up to 4 ARMv6K processors
• Snoop Control Unit
– Maintains L1 D-cache coherency
• Integrated distributed Interrupt
Controller (GIC)
• 1 or 2 external AMBA3 AXI master
interfaces
AAETC2v00
Architecture 20
• Each CPU features
– Private timer and watchdog
– MMU
– 16, 32 or 64K L1 caches
• 4-way set-associative
• Write-back, write-allocate
– Optional VFP
– JTAG based debug
CORTEX-A8
• ARMv7-A Architecture
– Thumb-2
– Thumb-2EE (Jazelle-RCT)
– TrustZone extensions
• Custom or synthesized design
• MMU
• 64-bit or 128-bit AXI Interface
AAETC2v00
Architecture 21
• 64-bit or 128-bit AXI Interface
• L1 caches
– 16 or 32KB each
• Unified L2 cache
– 0-2MB in size
– 8-way set-associative
• Optional features
• VFPv3 Vector Floating-Point
• NEON media processing engine
• Dual-issue, super-scalar 13-stage pipeline
• Branch Prediction & Return Stack
• NEON and VFP implemented at end of pipeline
CORTEX-A9 MPCORE
• ARMv7-A Architecture
– ARM, Thumb-2, Thumb-2EE
– TrustZone support
• Snoop Control Unit
– Maintains L1 Data cache coherency between
processors
– Arbitrates accesses to the L2 memory system
– Optional Accelerator Coherency Port
Cluster of up to 4 Cortex-A9
processors
AAETC2v00
Architecture 22
– Optional Accelerator Coherency Port
• Integrated Interrupt Controller (GIC)
• Variable-length Multi-issue pipeline
• 64-bit AXI instruction and data interfaces
• L1 Data and Instruction caches
– 16-64KB each
– 4-way set-associative
• Single-core version does not have integrated
interrupt controller
– Supports standard interface for PL390 GIC
• Optional features
• PTM instruction trace interface
• IEM power saving support
• Full Jazelle DBX support
• VFPv3-D16 Floating-Point Unit (FPU)
or NEON™ media processing engine
CORTEX-A5 MPCORE
• ARMv7-A Architecture
– ARM, Thumb-2, Thumb-2EE
– TrustZone support
• Snoop Control Unit
– Maintains L1 Data cache coherency between
processors
– Arbitrates accesses to the L2 memory system
Cluster of up to 4 Cortex-A5
processors
AAETC2v00
Architecture 23
– Arbitrates accesses to the L2 memory system
– Optional Accelerator Coherency Port
• Integrated Interrupt Controller (GIC)
– Not integrated in single-core configuration
• 64-bit AXI instruction and data interfaces
• L1 Data and Instruction caches
– 4-64KB each
– 4-way set-associative
• Optional features
• PTM instruction trace interface
• IEM power saving support
• Full Jazelle DBX support
• VFPv3-D16 Floating-Point Unit (FPU)
or NEON™ media processing engine
CORTEX-A15 MPCORE
• 1-4 processors per cluster
• Fixed size L1 caches (32KB)
• Integrated L2 Cache
– 512KB – 4MB
• System-wide coherency support with
AMBA 4 ACE
AAETC2v00
Architecture 24
AMBA 4 ACE
• Backward-compatible with
AXI3 interconnect
• Integrated Interrupt Controller
– 0-224 external interrupts for entire cluster
• CoreSight debug
• Advanced Power Management
• Large Physical Address Extensions (LPAE) to ARMv7-A Architecture
• Virtualization Extensions to ARMv7-A Architecture
CORTEX-A7 MPCORE
• Architecturally identical to Cortex-A15
• Smaller, lower power and performance
than Cortex-A15
• 1-4 processors per cluster
• Optional integrated L2 Cache
• System-wide coherency support with
AAETC2v00
Architecture 25
• System-wide coherency support with
AMBA 4 ACE
• Backward-compatible with
AXI3 interconnect
• Optional integrated Interrupt Controller
• CoreSight debug
• Advanced Power Management
• Architectural changes:
• Large Physical Address Extensions (LPAE)
• Virtualization Extensions
CORTEX-R4
• ARMv7-R Architecture
– Hardware divide instructions
– Thumb-2 support
• 8-stage dual-issue pipeline
– Dynamic Branch prediction
– Return stack
AAETC2v00
Architecture 26
• Memory protection unit (MPU)
• Non-maskable interrupt option
• Configurable caches and TCMs
– External DMA support
– Optional parity error checking
• v7 Debug architecture
CORTEX-R5
• ARMv7-R Architecture
– Divide instructions
– Support for mixed endianness
– Unaligned data support
• Optional FPU
• High Performance Core
– 8-stage dual-issue pipeline
AAETC2v00
Architecture 27
– 8-stage dual-issue pipeline
– Program flow prediction
• L1 memory system
– Caches and TCMs
– Low latency peripheral ports
– Parity and ECC support
– Accelerator coherency port
• Optional second CPU
– Twin CPU or redundant CPU
ARMV7-M OVERVIEW
• Register and ISA changes
– Same register numbers, but only one set of general purpose registers
– Thumb-2 only - no ARM instruction set support
– No CPSR - use different set of status registers
• Different processor modes and exception model
– Only two modes - Thread mode and Handler mode (each with their own stack
AAETC2v00
Architecture 28
– Only two modes - Thread mode and Handler mode (each with their own stack
pointer)
– Vector table contains addresses, not instructions
– Interrupts automatically save/restore state (r0-r3, r12, lr)
– Exception handlers can be completely programmed in C
• No coprocessor 15 (system control coprocessor)
– All control registers are memory-mapped
• Fixed memory map for external memory
– No cache, no MMU
CORTEX-M3
• ARMv7-M Architecture
• Thumb-2 only
• Fully programmable in C
• 3-stage pipeline
• von Neumann architecture
• Optional MPU
• AHB-Lite bus interface
AAETC2v00
Architecture 29
Cortex M3 Total
60k* Gates
• AHB-Lite bus interface
• Fixed memory map
• 1-240 interrupts
• Configurable priority levels
• Non-Maskable Interrupt support
• Debug and Sleep control
• Serial wire or JTAG debug
• Optional ETM
CORTEX-M4
• ARMv7E-M Architecture
• Thumb-2 only
• DSP extensions
• Optional FPU (Cortex-M4F)
• Otherwise, same as Cortex-M3
AAETC2v00
Architecture 30
Cortex M3 Total
60k* Gates
• Implements full Thumb-2
instruction set
• Saturated math (e.g. QADD)
• Packing and unpacking (e.g. UXTB)
• Signed multiply (e.g. SMULTB)
• SIMD (e.g. ADD8)
CORTEX-M0
• ARMv6-M Architecture
• 16-bit Thumb-2 with system control
instructions
• Fully programmable in C
• 3-stage pipeline
• von Neuman architecture
• AHB-Lite bus interface
• Fixed memory map
AAETC2v00
Architecture 31
Cortex M3 Total
60k* Gates
• Fixed memory map
• 1-32 interrupts
• Configurable priority levels
• Non-Maskable Interrupt support
• Low power support
• Core configured with or without
debug
• Variable number of watchpoints and
breakpoints
CORTEX-M0+
• ARMv6-M Architecture
• Fully programmable in C
• 2-stage pipeline
• Optional MPU
• Optional User/Privilege support
• AHB-Lite bus interface
• Relocatable vector table
AAETC2v00
Architecture 32
•
• Optional system timer
• Optional debug support
• 1-32 interrupts
• Configurable priority levels
• Non-Maskable Interrupt support
• Low power support
• Single-cycle I/O portMost power-efficient ARM
processor to date!
SECURCORE - SC100, SC200, SC300
• The first secure 32-bit RISC
processor
• Intended for use in smart cards and
other secure embedded applications
AAETC2v00
Architecture 33
• Secure design based on existing
ARM core designs (ARM7, Cortex-
M3)
– Synthesizable, fully static design
– Secure Memory Protection Unit
– Thumb support for code density
– Specific and unique anti-
counterfeiting design features
– Small and power-efficient
AGENDA
Introduction to ARM and the Architecture
Processor Families
• Programmer’s Model
AAETC2v00
Architecture 34
• Programmer’s Model
Exceptions and Interrupts
ARM PROCESSOR MODES
Mode Description
Supervisor
(SVC)
Entered on reset and when a Supervisor call instruction
(SVC) is executed
FIQ Entered when a high priority (fast) interrupt is raised
IRQ Entered when a normal priority interrupt is raised
Exceptionmodes
AAETC2v00
Architecture 35
Privileged
modes
Abort Used to handle memory access violations
Undef Used to handle undefined instructions
Hyp Used for hardware virtualization support
Monitor Used for TrustZone secure monitor program
System Privileged mode using the same registers as User mode
User Mode under which most Applications / OS tasks run
Unprivileged
mode
Exceptionmodes
Cortex-A15/A7only
Same
registerbank
ARM REGISTER SET
• General purpose
registers
r0-r12
r13 (sp)
r0
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r8
r9
r10
r11
Banked registers
AAETC2v00
Architecture 36
r14 (lr)
r15 (pc)
cpsr
spsr User IRQ FIQ Undef Abort
r11
r12
r15 (pc)
cpsr
r13 (sp)
r14 (lr)
spsr
r13 (sp)
r14 (lr)
r11
r12
r13 (sp)
r14 (lr)
spsr spsr
r13 (sp)
r14 (lr)
spsr
r13 (sp)
r14 (lr)
spsr
r13 (sp)
r14 (lr)
SVC
PSR
REGISTER SET BEHAVIOR ON
EXCEPTIONS
User moder0
r1
r2
r3
r4
r5
r6
r7
r8 r8
FIQ mode r0
r1
r2
r3
r4
r5
r6
r7
r8 r8
Registers in use Registers in use
AAETC2v00
Architecture 37
r8
r9
r10
r11
r12
r15 (pc)
cpsr
r13 (sp)
r14 (lr)
r8
r9
r10
r11
r12
r13 (sp)
r14 (lr)
spsr
FIQ EXCEPTION
r8
r9
r10
r11
r12
r15 (pc)
cpsr
r13 (sp)
r14 (lr)
r8
r9
r10
r11
r12
r13 (sp)
r14 (lr)
spsr
Return address calculated from User mode
PC value and stored in FIQ mode LR
User mode CPSR copied to FIQ mode SPSR
INSTRUCTION SET
• ARM instruction set
– All instructions are 32-bit
– Most instructions can be executed conditionally
• Thumb instruction set
– 16-bit instruction set
No condition execution (except for branches)
AAETC2v00
Architecture 38
– 16-bit instruction set
– No condition execution (except for branches)
– Optimized for code density from C code (~65% of ARM code size)
• Thumb-2 technology
– Extension to Thumb instruction set
– Mix of 16-bit and 32-bit instructions
– Condition execution via IT instruction
– Higher performance than Thumb and smaller than ARM
AGENDA
Introduction to ARM and the Architecture
Processor Families
Programmer’s Model
AAETC2v00
Architecture 39
Programmer’s Model
• Exceptions and Interrupts
EXCEPTION BASICS
• Recall modes and registers…
AAETC2v00
Architecture 40
ENTRY/EXIT SEQUENCE
Save processor status
Copies CPSR into SPSR_<mode>
Stores the return address in
LR_<mode>
Change processor status for exception
Mode field bits
ARM or Thumb (T2) state
Interrupt disable bits (if appropriate)
Save Regs (r1~r12) in stacks
(if necessary)
Exception handling code
Restore Regs from stacks
Applicationcode
AAETC2v00
Architecture 41
Interrupt disable bits (if appropriate)
Sets PC to vector address
Restore CPSR from SPSR_<mode>
Restore PC from LR_<mode>
Restore Regs from stacks
(if necessary)>
Automatic processor actions Handler code
Applicationcode
ENTRY/EXIT INSTRUCTIONS
There are three ways of doing this…
1. Use a data processing instruction
To return from an exception,
you must…
1. Restore CPSR from SPSR
2. Restore PC from LR
This must be done atomically
AAETC2v00
Architecture 42
1. Use a data processing instruction
MOVS PC, LR
SUBS PC, LR, #4
2. Use an LDM instruction
LDMFD sp! {pc}^
3. Use a dedicated exception return instruction
SRSFD sp!, #mode ; Save SPSR and LR to stack of specified
mode
RFEFD sp! ; Restore PC and CPSR from current mode
stack
^
LINK REGISTER ADJUSTMENTS
• On taking an exception …
… the link register (LR_<mode>) is automatically populated with the return
address
• Before returning …
… the link register must be adjusted, depending on the exception type
Exception Adjustment Instruction returned to
AAETC2v00
Architecture 43
Exception Adjustment Instruction returned to
SVC 0 Next instruction
Undef 0 Next instruction
Prefetch Abort -4 Aborting instruction
Data Abort -8 Aborting instruction if precise
FIQ -4 Next instruction
IRQ -4 Next instruction
Note that there is no defined method of returning from a reset exception!
VECTOR TABLE
• Location of vector table
– Default to 0x00000000
– Can be relocated to 0xffff0000 in HIVECS mode
• Configurable via V bit of CP15 System Control Register
• Determined by VINITHI signal at reset
Vectors
AAETC2v00
Architecture 44
• Content of vector table for Cortex-A/R processors
– A branch instruction
• Easy to use if handlers are within range
– LDR pc, […]
• More dynamic vector table
• Range is unlimited within address space
Vectors
LDR PC, Reset_Addr
LDR PC, Undefined_Addr
LDR PC, SVC_Addr
LDR PC, Prefetch_Addr
LDR PC, Abort_Addr
NOP ; Reserved vector
LDR PC, IRQ_Addr
LDR PC, FIQ_Addr
Reset_Addr DCD Reset_Handler
Undefined_Addr DCD Undefined_Handler
SVC_Addr DCD SVC_Handler
Prefetch_Addr DCD Prefetch_Handler
Abort_Addr DCD Abort_Handler
IRQ_Addr DCD IRQ_Handler
FIQ_Addr DCD FIQ_Handler
INTERRUPTS AND INTERRUPT
CONTROLLERS
• Most systems use an interrupt controller
ARM926EJ-SInterrupt
sources nFIQ
Interrupt
Controller
nIRQ
AAETC2v00
Architecture 45
Most systems use an interrupt controller
– Prioritization and pre-emption
– Automatic vectoring in most cases
– Generally used for IRQ only
• IRQ/FIQ and their difference
– R8-R12 are banked in FIQ
– FIQ has higher priority than IRQ
– IRQ is disabled by processor when entering all exceptions.
FIQ is disabled by processor only when entering Reset/FIQ exception
SIMPLE EXCEPTION HANDLING
Save context (on stack)
Identify Interrupt resource
IRQ automatically disabled
AAETC2v00
Architecture 46
Assembler handler
Applicationcode
Call C handler
Clear Interrupt resource
Restore context and return
C handler
IRQ automatically re-enabled
RE-ENABLING INTERRUPTS
• There are two ways to enable/disable interrupts
Modify CPSR Use CPS instruction
MSR r0, CPSR CPSID i
AAETC2v00
Architecture 47
MSR r0, CPSR
BIC r0, #I_bit
MRS CPSR_c, r0
CPSID i
Works on all architectures
Uses read-modify-write so may need to be careful
Works on ARMv6 and later
Atomic operation
Can also change mode
RE-ENABLING INTERRUPTS
• Once IRQ is re-enabled, IRQ handlers must be re-entrant
• Problem
A fresh interrupt could occur at any time
This would cause the processor to store the return address of the new interrupt in LR_IRQ
Unless the programmer is careful, this will over-write the original return address
This will cause a program failure
AAETC2v00
Architecture 48
This will cause a program failure
• Solution
The interrupt handler must store LR and SPSR (usually on the stack)
To prevent over-write of LR, the handler must change to another privileged mode
This must be done before re-enabling interrupts
Before exist, the handler must restore LR and SPSR
Note that a DSB instruction may be required before re-enabling
interrupts to ensure that the interrupt condition is cleared
RE-ENTRANT EXCEPTION HANDLING
Save LR, SPSR (on SVC stack)
Switch to SVC mode
Save {r0-r3, r12} to stack
Identify interrupt source
IRQ automatically disabled
AAETC2v00
Architecture 49
Assembler handler
Applicationcode
Identify interrupt source
Enable IRQ
C handler
IRQ automatically re-enabled
Call C handler
Disable IRQ
Restore {r0-r3,r12} from stack
Return from SVC stack
SVC EXCEPTION
• SVC instruction (previously called SWI)
– Thumb SVC instruction, containing 8-bit SVC number
– SVC 0x12
– ARM SVC instruction, containing 24-bit SVC number
– SVC 0x123456
15 8 7 0
Op Code SWI number
AAETC2v00
Architecture 50
– SVC 0x123456
• What SVC is used for?
– Implementing system call to enable user mode application calling
privilege
– Semihosting (discuss later)
2831 2427 0
Cond Op Code SWI number
23
SVC EXAMPLE
App
Glibc
User Space
SVC
SVC
AAETC2v00
Architecture 51
System Call Interface
Kernel
Architecture dependent Code
Hardware
Kernel Space
ABORT EXCEPTIONS
• Aborts are caused by
– Bus error (external fault)
– Permission violation (internal fault)
– Virtual address translation failure (internal fault)
• There are two kinds of abort
– Data abort
AAETC2v00
Architecture 52
– Data abort
• Caused by a memory or permission error on a data access
– Prefetch abort
• Caused by an error on an instruction fetch
• Instruction is flagged in the fetch stage
• Abort is taken if the instruction reaches the execution stage
• Aborts may be precise or imprecise
– For a precise abort, the instruction causing the abort can be identified
– For an imprecise abort, this is not the case
– Imprecise aborts are usually fatal (to the system or process)
ABORT EXAMPLES
• Examples of synchronous abort
– Attempt to access privileged memory in User mode
– Unaligned access in Strongly Ordered or Device memory
– Unaligned access when A bit in System Control Register is set
• Examples of Asynchronous abort
AAETC2v00
Architecture 53
• Examples of Asynchronous abort
– Write which uses write bufffer
– Cache cast-out of dirty data
• Abort status information
– Abort status is stored in IFSR (for prefetch) or DFSR (for data)
– Abort address is stored in IFAR or DFAR
– DFAR contains an undefined value in the case of an imprecise abort
ABORT MODEL
• The “Abort Model” defines the value left in the base register for auto-
update addressing modes
• For example, if the following instruction causes an abort…
LDR r0, [r3], #4
…what value will be in r3 on entry to the abort handler?
AAETC2v00
Architecture 54
• ARMv7 cores implement a “base-restored” abort model
• This ensures that the original, unchanged value is left in the base register
• Earlier cores (prior to ARM9) implement a “base-updated” abort model
• This leaves the updated value in the base register
• For these cores, the abort handler must contain code to determine and reverse any update to
the base register
UNDEF EXCEPTION
• There are several possible causes for an Undefined Instruction
exception
– An invalid instruction encoding
• This usually indicates a fatal condition e.g. attempting to execute data
– The targeted coprocessor is not available
• The exception handler may be capable of emulating the coprocessor function
AAETC2v00
Architecture 55
• This is often used for soft FP emulation on systems with no FP hardware
support
– The targeted coprocessor is not enabled or is powered down
• The exception handler can enable (or power up) the coprocessor and then
return to retry the failed instruction
• This mechanism is sometimes used by Operating Systems to implement “lazy
context switching”
– A coprocessor is configured for Privileged or Secure access only
• The action will be system-dependent as it may indicate an attempt by a
malicious process to subvert system security
SOFTWARE & SYSTEMS
DESIGN
2 - Architecture

Más contenido relacionado

La actualidad más candente

Introduction to armv8 aarch64
Introduction to armv8 aarch64Introduction to armv8 aarch64
Introduction to armv8 aarch64Yi-Hsiu Hsu
 
EMBEDDED OS
EMBEDDED OSEMBEDDED OS
EMBEDDED OSAJAL A J
 
CPU Architectures for Mobile Phone Devices
CPU Architectures for Mobile Phone DevicesCPU Architectures for Mobile Phone Devices
CPU Architectures for Mobile Phone Devicessagar chansaulia
 
Architecture Exploration of RISC-V Processor and Comparison with ARM Cortex-A53
Architecture Exploration of RISC-V Processor and Comparison with ARM Cortex-A53Architecture Exploration of RISC-V Processor and Comparison with ARM Cortex-A53
Architecture Exploration of RISC-V Processor and Comparison with ARM Cortex-A53KarthiSugumar
 
Arm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler supportArm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler supportLinaro
 
Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021
Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021
Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021Deepak Shankar
 
LCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLinaro
 
RISC-V & SoC Architectural Exploration for AI and ML Accelerators
RISC-V & SoC Architectural Exploration for AI and ML AcceleratorsRISC-V & SoC Architectural Exploration for AI and ML Accelerators
RISC-V & SoC Architectural Exploration for AI and ML AcceleratorsRISC-V International
 
Introduction to NVMe Over Fabrics-V3R
Introduction to NVMe Over Fabrics-V3RIntroduction to NVMe Over Fabrics-V3R
Introduction to NVMe Over Fabrics-V3RSimon Huang
 
AMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor ArchitectureAMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor ArchitectureAMD
 
ISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
ISSCC 2018: "Zeppelin": an SoC for Multi-chip ArchitecturesISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
ISSCC 2018: "Zeppelin": an SoC for Multi-chip ArchitecturesAMD
 
All Presentations during CXL Forum at Flash Memory Summit 22
All Presentations during CXL Forum at Flash Memory Summit 22All Presentations during CXL Forum at Flash Memory Summit 22
All Presentations during CXL Forum at Flash Memory Summit 22Memory Fabric Forum
 
Standardizing the tee with global platform and RISC-V
Standardizing the tee with global platform and RISC-VStandardizing the tee with global platform and RISC-V
Standardizing the tee with global platform and RISC-VRISC-V International
 
Deep learning: Hardware Landscape
Deep learning: Hardware LandscapeDeep learning: Hardware Landscape
Deep learning: Hardware LandscapeGrigory Sapunov
 

La actualidad más candente (20)

Introduction to armv8 aarch64
Introduction to armv8 aarch64Introduction to armv8 aarch64
Introduction to armv8 aarch64
 
EMBEDDED OS
EMBEDDED OSEMBEDDED OS
EMBEDDED OS
 
CPU Architectures for Mobile Phone Devices
CPU Architectures for Mobile Phone DevicesCPU Architectures for Mobile Phone Devices
CPU Architectures for Mobile Phone Devices
 
Andes RISC-V processor solutions
Andes RISC-V processor solutionsAndes RISC-V processor solutions
Andes RISC-V processor solutions
 
Introduction to ARM Architecture
Introduction to ARM ArchitectureIntroduction to ARM Architecture
Introduction to ARM Architecture
 
Architecture Exploration of RISC-V Processor and Comparison with ARM Cortex-A53
Architecture Exploration of RISC-V Processor and Comparison with ARM Cortex-A53Architecture Exploration of RISC-V Processor and Comparison with ARM Cortex-A53
Architecture Exploration of RISC-V Processor and Comparison with ARM Cortex-A53
 
Multicore computers
Multicore computersMulticore computers
Multicore computers
 
Arm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler supportArm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler support
 
Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021
Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021
Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021
 
LCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted Firmware
 
RISC-V & SoC Architectural Exploration for AI and ML Accelerators
RISC-V & SoC Architectural Exploration for AI and ML AcceleratorsRISC-V & SoC Architectural Exploration for AI and ML Accelerators
RISC-V & SoC Architectural Exploration for AI and ML Accelerators
 
Introduction to NVMe Over Fabrics-V3R
Introduction to NVMe Over Fabrics-V3RIntroduction to NVMe Over Fabrics-V3R
Introduction to NVMe Over Fabrics-V3R
 
AMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor ArchitectureAMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor Architecture
 
ISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
ISSCC 2018: "Zeppelin": an SoC for Multi-chip ArchitecturesISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
ISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
 
All Presentations during CXL Forum at Flash Memory Summit 22
All Presentations during CXL Forum at Flash Memory Summit 22All Presentations during CXL Forum at Flash Memory Summit 22
All Presentations during CXL Forum at Flash Memory Summit 22
 
Standardizing the tee with global platform and RISC-V
Standardizing the tee with global platform and RISC-VStandardizing the tee with global platform and RISC-V
Standardizing the tee with global platform and RISC-V
 
Uvm dac2011 final_color
Uvm dac2011 final_colorUvm dac2011 final_color
Uvm dac2011 final_color
 
Deep learning: Hardware Landscape
Deep learning: Hardware LandscapeDeep learning: Hardware Landscape
Deep learning: Hardware Landscape
 
Introduction to stm32-part2
Introduction to stm32-part2Introduction to stm32-part2
Introduction to stm32-part2
 
eMMC 5.0 Total IP Solution
eMMC 5.0 Total IP SolutioneMMC 5.0 Total IP Solution
eMMC 5.0 Total IP Solution
 

Similar a ARM AAE - Architecture

AAME ARM Techcon2013 001v02 Architecture and Programmer's model
AAME ARM Techcon2013 001v02 Architecture and Programmer's modelAAME ARM Techcon2013 001v02 Architecture and Programmer's model
AAME ARM Techcon2013 001v02 Architecture and Programmer's modelAnh Dung NGUYEN
 
Arm Processors Architectures
Arm Processors ArchitecturesArm Processors Architectures
Arm Processors ArchitecturesMohammed Hilal
 
17 october embedded seminar
17 october embedded seminar17 october embedded seminar
17 october embedded seminarAmir Sherman
 
04 Mcu Day Stellaris 8 12b Editado
04   Mcu Day   Stellaris 8 12b   Editado04   Mcu Day   Stellaris 8 12b   Editado
04 Mcu Day Stellaris 8 12b EditadoTexas Instruments
 
AAME ARM Techcon2013 006v02 Implementation Diversity
AAME ARM Techcon2013 006v02 Implementation DiversityAAME ARM Techcon2013 006v02 Implementation Diversity
AAME ARM Techcon2013 006v02 Implementation DiversityAnh Dung NGUYEN
 
ds894-zynq-ultrascale-plus-overview
ds894-zynq-ultrascale-plus-overviewds894-zynq-ultrascale-plus-overview
ds894-zynq-ultrascale-plus-overviewAngela Suen
 
Arm architecture chapter2_steve_furber
Arm architecture chapter2_steve_furberArm architecture chapter2_steve_furber
Arm architecture chapter2_steve_furberasodariyabhavesh
 
Arrow Israel the MCU Home
Arrow Israel the MCU HomeArrow Israel the MCU Home
Arrow Israel the MCU HomeAmir Sherman
 
Introduction to embedded System.pptx
Introduction to embedded System.pptxIntroduction to embedded System.pptx
Introduction to embedded System.pptxPratik Gohel
 
Introduction to arm processor
Introduction to arm processorIntroduction to arm processor
Introduction to arm processorRAMPRAKASHT1
 
Stellaris® 9000 Family of ARM® Cortex™-M3
Stellaris® 9000 Family of ARM® Cortex™-M3 Stellaris® 9000 Family of ARM® Cortex™-M3
Stellaris® 9000 Family of ARM® Cortex™-M3 Premier Farnell
 
TRACK B: Multicores & Network On Chip Architectures/ Oren Hollander
TRACK B: Multicores & Network On Chip Architectures/ Oren HollanderTRACK B: Multicores & Network On Chip Architectures/ Oren Hollander
TRACK B: Multicores & Network On Chip Architectures/ Oren Hollanderchiportal
 

Similar a ARM AAE - Architecture (20)

AAME ARM Techcon2013 001v02 Architecture and Programmer's model
AAME ARM Techcon2013 001v02 Architecture and Programmer's modelAAME ARM Techcon2013 001v02 Architecture and Programmer's model
AAME ARM Techcon2013 001v02 Architecture and Programmer's model
 
A5 processor
A5 processorA5 processor
A5 processor
 
Arm Processors Architectures
Arm Processors ArchitecturesArm Processors Architectures
Arm Processors Architectures
 
17 october embedded seminar
17 october embedded seminar17 october embedded seminar
17 october embedded seminar
 
Arm arc-2016
Arm arc-2016Arm arc-2016
Arm arc-2016
 
Processors selection
Processors selectionProcessors selection
Processors selection
 
Archi arm2
Archi arm2Archi arm2
Archi arm2
 
04 Mcu Day Stellaris 8 12b Editado
04   Mcu Day   Stellaris 8 12b   Editado04   Mcu Day   Stellaris 8 12b   Editado
04 Mcu Day Stellaris 8 12b Editado
 
AAME ARM Techcon2013 006v02 Implementation Diversity
AAME ARM Techcon2013 006v02 Implementation DiversityAAME ARM Techcon2013 006v02 Implementation Diversity
AAME ARM Techcon2013 006v02 Implementation Diversity
 
Arm processor
Arm processorArm processor
Arm processor
 
ds894-zynq-ultrascale-plus-overview
ds894-zynq-ultrascale-plus-overviewds894-zynq-ultrascale-plus-overview
ds894-zynq-ultrascale-plus-overview
 
Zynq architecture
Zynq architectureZynq architecture
Zynq architecture
 
nios.ppt
nios.pptnios.ppt
nios.ppt
 
Arm architecture chapter2_steve_furber
Arm architecture chapter2_steve_furberArm architecture chapter2_steve_furber
Arm architecture chapter2_steve_furber
 
Arrow Israel the MCU Home
Arrow Israel the MCU HomeArrow Israel the MCU Home
Arrow Israel the MCU Home
 
Introduction to embedded System.pptx
Introduction to embedded System.pptxIntroduction to embedded System.pptx
Introduction to embedded System.pptx
 
Introduction to arm processor
Introduction to arm processorIntroduction to arm processor
Introduction to arm processor
 
Atmega 128 datasheet
Atmega 128   datasheetAtmega 128   datasheet
Atmega 128 datasheet
 
Stellaris® 9000 Family of ARM® Cortex™-M3
Stellaris® 9000 Family of ARM® Cortex™-M3 Stellaris® 9000 Family of ARM® Cortex™-M3
Stellaris® 9000 Family of ARM® Cortex™-M3
 
TRACK B: Multicores & Network On Chip Architectures/ Oren Hollander
TRACK B: Multicores & Network On Chip Architectures/ Oren HollanderTRACK B: Multicores & Network On Chip Architectures/ Oren Hollander
TRACK B: Multicores & Network On Chip Architectures/ Oren Hollander
 

Más de Anh Dung NGUYEN

ARM AAE - Developing Code for ARM
ARM AAE - Developing Code for ARMARM AAE - Developing Code for ARM
ARM AAE - Developing Code for ARMAnh Dung NGUYEN
 
AAME ARM Techcon2013 005v02 System Startup
AAME ARM Techcon2013 005v02 System StartupAAME ARM Techcon2013 005v02 System Startup
AAME ARM Techcon2013 005v02 System StartupAnh Dung NGUYEN
 
AAME ARM Techcon2013 004v02 Debug and Optimization
AAME ARM Techcon2013 004v02 Debug and OptimizationAAME ARM Techcon2013 004v02 Debug and Optimization
AAME ARM Techcon2013 004v02 Debug and OptimizationAnh Dung NGUYEN
 
AAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAnh Dung NGUYEN
 
AAME ARM Techcon2013 003v02 Software Development
AAME ARM Techcon2013 003v02  Software DevelopmentAAME ARM Techcon2013 003v02  Software Development
AAME ARM Techcon2013 003v02 Software DevelopmentAnh Dung NGUYEN
 
AAME ARM Techcon2013 Intro
AAME ARM Techcon2013 IntroAAME ARM Techcon2013 Intro
AAME ARM Techcon2013 IntroAnh Dung NGUYEN
 

Más de Anh Dung NGUYEN (7)

ARM AAE - Developing Code for ARM
ARM AAE - Developing Code for ARMARM AAE - Developing Code for ARM
ARM AAE - Developing Code for ARM
 
ARM AAE - Introduction
ARM AAE - IntroductionARM AAE - Introduction
ARM AAE - Introduction
 
AAME ARM Techcon2013 005v02 System Startup
AAME ARM Techcon2013 005v02 System StartupAAME ARM Techcon2013 005v02 System Startup
AAME ARM Techcon2013 005v02 System Startup
 
AAME ARM Techcon2013 004v02 Debug and Optimization
AAME ARM Techcon2013 004v02 Debug and OptimizationAAME ARM Techcon2013 004v02 Debug and Optimization
AAME ARM Techcon2013 004v02 Debug and Optimization
 
AAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced Features
 
AAME ARM Techcon2013 003v02 Software Development
AAME ARM Techcon2013 003v02  Software DevelopmentAAME ARM Techcon2013 003v02  Software Development
AAME ARM Techcon2013 003v02 Software Development
 
AAME ARM Techcon2013 Intro
AAME ARM Techcon2013 IntroAAME ARM Techcon2013 Intro
AAME ARM Techcon2013 Intro
 

Último

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Último (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

ARM AAE - Architecture

  • 2. AGENDA • Introduction to ARM and the Architecture Processor Families Programmer’s Model AAETC2v00 Architecture 2 Programmer’s Model Exceptions and Interrupts
  • 3. ARM LTD • ARM founded in November 1990 – Advanced RISC Machines • Company headquarters in Cambridge, UK – Processor design centers in Cambridge, Austin, and Sophia Antipolis – Sales, support, and engineering offices all over the world • Best known for its range of RISC processor cores designs AAETC2v00 Architecture 3 • Best known for its range of RISC processor cores designs – Other products – fabric IP, software tools, models, cell libraries - to help partners develop and ship ARM-based SoCs • ARM does not manufacture silicon • More information about ARM and our offices on their web site: – http://www.arm.com/aboutarm/
  • 4. On chip EXAMPLE ARM-BASED SYSTEM • ARM core deeply embedded within an SoC – External debug and trace via JTAG or CoreSight interface • Design can have both external and internal memories – Varying width, speed and size – depending on system requirements ARM Processor core AMBAAXI External Memory Interface DMA Port Clocks and Reset Controller DEBUG nIRQ nFIQ FLASH SDRAM AAETC2v00 Architecture 4 memory depending on system requirements • Can include ARM licensed CoreLink peripherals – Interrupt controller, since core only has two interrupt sources – Other peripherals and interfaces • Can include on-chip memory from ARM Artisan Physical IP Libraries • Elements connected using AMBA (Advanced Microcontroller Bus Architecture) APB Bridge AMBAAPB CoreLink Interrupt Controller Other CoreLink Peripherals nFIQ ARM based SoC Custom Peripherals
  • 8. ARCHITECTURE EVOLUTION AAETC2v00 Architecture 8 • Compatibility • Backward compatibility • ARMv6 code cannot be guaranteed to run on a ARMv5 processor but will run on a ARMv7 processor
  • 9. ARCHITECTURE ARMV7 PROFILES • Application profile (ARMv7-A) – Memory management support (MMU) – Highest performance at low power • Influenced by multi-tasking OS system requirements – TrustZone and Jazelle-RCT for a safe, extensible system – e.g. Cortex-A5, Cortex-A9 • Real-time profile (ARMv7-R) AAETC2v00 Architecture 9 • Real-time profile (ARMv7-R) – Protected memory (MPU) – Low latency and predictability ‘real-time’ needs – Evolutionary path for traditional embedded business – e.g. Cortex-R4 • Microcontroller profile (ARMv7-M, ARMv7E-M, ARMv6-M) – Lowest gate count entry point – Deterministic and predictable behavior a key priority – Deeply embedded use – e.g. Cortex-M3
  • 10. TRUSTZONE SECURITY EXTENSIONS • Extensions added for ARM1176, and for all V7-A cores • Application is divided into “Secure” and “Non-Secure” worlds • New “Secure Monitor” exception mode • Secure Monitor exception handling code acts as a gatekeeper for moving between worlds. • Separate exception tables for secure and non secure worlds • Memory (on-chip, caches, and TCMS) can be marked for secure access only • Debug for secure world code and data restricted Secure WorldNormal World System Boot AAETC2v00 Architecture 10 Secure World Secure Kernel Normal World Secure Monitor Secure service Platform OS User mode Privileged mode User mode Privileged mode Process
  • 11. LPAE • The Large Physical Address Extensions (LPAE) is an optional extension to ARMv7-A – Supported by Cortex-A15 and Cortex-A7 • LPAE provides: – New translation table format - Long-descriptor Format – 32-bit virtual addresses, with 40-bit physical address – Can still use (existing) Short-descriptor page table format AAETC2v00 Architecture 11 – Can still use (existing) Short-descriptor page table format 32-bit virtual address space 40-bit physical address space • New Privileged Execute Never (PXN) attribute • New hierarchical attributes (XNTable, PXNTable, NSTable and APTable)
  • 12. ARMV7-A VIRTUALIZATION EXTENSIONS • ARMv7-A has an optional virtualization extension – Implemented by the Cortex-A15 and Cortex-A7 • Provides hardware support for “full” virtualization – In the Normal world only, no virtualization support in the Secure world Secure worldNormal world AAETC2v00 Architecture 12 Guest OS Hypervisor Trusted OS Trusted Service(s) Secure Monitor Application(s) Guest OS Application(s)PL0 PL1 PL2
  • 13. WHICH ARCHITECTURE IS MY PROCESSOR? AAETC2v00 Architecture 13
  • 14. AGENDA Introduction to ARM and the Architecture • Processor Families Programmer’s Model AAETC2v00 Architecture 14 Programmer’s Model Exceptions and Interrupts
  • 15. ARM7TDMI PROCESSOR • 3-stage pipeline • on Neumann architecture – Single instruction and data memory interface • T D M I = T Thumb instruction set support AAETC2v00 Architecture 15 D Debug support M Enhanced multiplier (32x8) with instructions for 64-bit results I Embedded ICE Logic • ARM7TDMI-S - synthesizable version of the ARM7TDMI – Instruction Set and Cycle compatible with ARM7TDMI Hard Macrocell – Single Clock Design (rising edge) – Simplified Bus Interface
  • 16. ARM9TDMI PROCESSOR FAMILY • 5-stage pipeline – Improved maximum clock frequency • Harvard architecture – Separate instruction and data interface – Simultaneous instruction and data access • Normally supplied with caches AAETC2v00 Architecture 16 • Normally supplied with caches attached • ARM920T – 2 x 16K caches – Memory Management Unit (MMU) – Write Buffer • ARM922T (pictured) – Same as ARM922T but with 2 x 8K caches • ARM940T – Memory Protection Unit (MPU)
  • 17. ARM926EJ-S PROCESSOR • Based on the ARM9-E core • 5-stage pipeline (similar to ARM9TDMI) • Configurable Instruction and Data caches • Configurable Instruction and Data AAETC2v00 Architecture 17 • Configurable Instruction and Data TCMs • AHB bus interface • Memory Management Unit • Jazelle DBX support – Can execute some Java bytecodes in hardware
  • 18. ARM1176JZ(F)-S PROCESSOR • ARM1176JZ(F)-S – Architecture v6Z - TrustZone – 8-stage pipeline • Load/Store Unit separate from ALU • Static and dynamic branch prediction – Physically-tagged 4-64k caches – Dual configurable TCMs AAETC2v00 Architecture 18 – Dual configurable TCMs – Memory management unit – Four AXI memory ports – Jazelle-DBX support – Optional integrated VFP coprocessor • ARM1136J(F)-S (not shown here) – AHB memory interface – No TrustZone support – Single TCMs
  • 19. ARM1156T2(F)-S PROCESSOR • ARM1156T2(F)-S – Architecture v6T2 – Thumb-2 support • Core can run completely in Thumb state (including exceptions) – 9-stage pipeline • Load/Store Unit separate from ALU AAETC2v00 Architecture 19 from ALU • Static and dynamic branch prediction – Physically-tagged 4-64k caches – Configurable TCMs – Memory protection unit – Three AXI memory ports – Optional integrated vectored interrupt controller port – Optional integrated VFP coprocessor
  • 20. ARM11 MPCORE PROCESSOR • Up to 4 ARMv6K processors • Snoop Control Unit – Maintains L1 D-cache coherency • Integrated distributed Interrupt Controller (GIC) • 1 or 2 external AMBA3 AXI master interfaces AAETC2v00 Architecture 20 • Each CPU features – Private timer and watchdog – MMU – 16, 32 or 64K L1 caches • 4-way set-associative • Write-back, write-allocate – Optional VFP – JTAG based debug
  • 21. CORTEX-A8 • ARMv7-A Architecture – Thumb-2 – Thumb-2EE (Jazelle-RCT) – TrustZone extensions • Custom or synthesized design • MMU • 64-bit or 128-bit AXI Interface AAETC2v00 Architecture 21 • 64-bit or 128-bit AXI Interface • L1 caches – 16 or 32KB each • Unified L2 cache – 0-2MB in size – 8-way set-associative • Optional features • VFPv3 Vector Floating-Point • NEON media processing engine • Dual-issue, super-scalar 13-stage pipeline • Branch Prediction & Return Stack • NEON and VFP implemented at end of pipeline
  • 22. CORTEX-A9 MPCORE • ARMv7-A Architecture – ARM, Thumb-2, Thumb-2EE – TrustZone support • Snoop Control Unit – Maintains L1 Data cache coherency between processors – Arbitrates accesses to the L2 memory system – Optional Accelerator Coherency Port Cluster of up to 4 Cortex-A9 processors AAETC2v00 Architecture 22 – Optional Accelerator Coherency Port • Integrated Interrupt Controller (GIC) • Variable-length Multi-issue pipeline • 64-bit AXI instruction and data interfaces • L1 Data and Instruction caches – 16-64KB each – 4-way set-associative • Single-core version does not have integrated interrupt controller – Supports standard interface for PL390 GIC • Optional features • PTM instruction trace interface • IEM power saving support • Full Jazelle DBX support • VFPv3-D16 Floating-Point Unit (FPU) or NEON™ media processing engine
  • 23. CORTEX-A5 MPCORE • ARMv7-A Architecture – ARM, Thumb-2, Thumb-2EE – TrustZone support • Snoop Control Unit – Maintains L1 Data cache coherency between processors – Arbitrates accesses to the L2 memory system Cluster of up to 4 Cortex-A5 processors AAETC2v00 Architecture 23 – Arbitrates accesses to the L2 memory system – Optional Accelerator Coherency Port • Integrated Interrupt Controller (GIC) – Not integrated in single-core configuration • 64-bit AXI instruction and data interfaces • L1 Data and Instruction caches – 4-64KB each – 4-way set-associative • Optional features • PTM instruction trace interface • IEM power saving support • Full Jazelle DBX support • VFPv3-D16 Floating-Point Unit (FPU) or NEON™ media processing engine
  • 24. CORTEX-A15 MPCORE • 1-4 processors per cluster • Fixed size L1 caches (32KB) • Integrated L2 Cache – 512KB – 4MB • System-wide coherency support with AMBA 4 ACE AAETC2v00 Architecture 24 AMBA 4 ACE • Backward-compatible with AXI3 interconnect • Integrated Interrupt Controller – 0-224 external interrupts for entire cluster • CoreSight debug • Advanced Power Management • Large Physical Address Extensions (LPAE) to ARMv7-A Architecture • Virtualization Extensions to ARMv7-A Architecture
  • 25. CORTEX-A7 MPCORE • Architecturally identical to Cortex-A15 • Smaller, lower power and performance than Cortex-A15 • 1-4 processors per cluster • Optional integrated L2 Cache • System-wide coherency support with AAETC2v00 Architecture 25 • System-wide coherency support with AMBA 4 ACE • Backward-compatible with AXI3 interconnect • Optional integrated Interrupt Controller • CoreSight debug • Advanced Power Management • Architectural changes: • Large Physical Address Extensions (LPAE) • Virtualization Extensions
  • 26. CORTEX-R4 • ARMv7-R Architecture – Hardware divide instructions – Thumb-2 support • 8-stage dual-issue pipeline – Dynamic Branch prediction – Return stack AAETC2v00 Architecture 26 • Memory protection unit (MPU) • Non-maskable interrupt option • Configurable caches and TCMs – External DMA support – Optional parity error checking • v7 Debug architecture
  • 27. CORTEX-R5 • ARMv7-R Architecture – Divide instructions – Support for mixed endianness – Unaligned data support • Optional FPU • High Performance Core – 8-stage dual-issue pipeline AAETC2v00 Architecture 27 – 8-stage dual-issue pipeline – Program flow prediction • L1 memory system – Caches and TCMs – Low latency peripheral ports – Parity and ECC support – Accelerator coherency port • Optional second CPU – Twin CPU or redundant CPU
  • 28. ARMV7-M OVERVIEW • Register and ISA changes – Same register numbers, but only one set of general purpose registers – Thumb-2 only - no ARM instruction set support – No CPSR - use different set of status registers • Different processor modes and exception model – Only two modes - Thread mode and Handler mode (each with their own stack AAETC2v00 Architecture 28 – Only two modes - Thread mode and Handler mode (each with their own stack pointer) – Vector table contains addresses, not instructions – Interrupts automatically save/restore state (r0-r3, r12, lr) – Exception handlers can be completely programmed in C • No coprocessor 15 (system control coprocessor) – All control registers are memory-mapped • Fixed memory map for external memory – No cache, no MMU
  • 29. CORTEX-M3 • ARMv7-M Architecture • Thumb-2 only • Fully programmable in C • 3-stage pipeline • von Neumann architecture • Optional MPU • AHB-Lite bus interface AAETC2v00 Architecture 29 Cortex M3 Total 60k* Gates • AHB-Lite bus interface • Fixed memory map • 1-240 interrupts • Configurable priority levels • Non-Maskable Interrupt support • Debug and Sleep control • Serial wire or JTAG debug • Optional ETM
  • 30. CORTEX-M4 • ARMv7E-M Architecture • Thumb-2 only • DSP extensions • Optional FPU (Cortex-M4F) • Otherwise, same as Cortex-M3 AAETC2v00 Architecture 30 Cortex M3 Total 60k* Gates • Implements full Thumb-2 instruction set • Saturated math (e.g. QADD) • Packing and unpacking (e.g. UXTB) • Signed multiply (e.g. SMULTB) • SIMD (e.g. ADD8)
  • 31. CORTEX-M0 • ARMv6-M Architecture • 16-bit Thumb-2 with system control instructions • Fully programmable in C • 3-stage pipeline • von Neuman architecture • AHB-Lite bus interface • Fixed memory map AAETC2v00 Architecture 31 Cortex M3 Total 60k* Gates • Fixed memory map • 1-32 interrupts • Configurable priority levels • Non-Maskable Interrupt support • Low power support • Core configured with or without debug • Variable number of watchpoints and breakpoints
  • 32. CORTEX-M0+ • ARMv6-M Architecture • Fully programmable in C • 2-stage pipeline • Optional MPU • Optional User/Privilege support • AHB-Lite bus interface • Relocatable vector table AAETC2v00 Architecture 32 • • Optional system timer • Optional debug support • 1-32 interrupts • Configurable priority levels • Non-Maskable Interrupt support • Low power support • Single-cycle I/O portMost power-efficient ARM processor to date!
  • 33. SECURCORE - SC100, SC200, SC300 • The first secure 32-bit RISC processor • Intended for use in smart cards and other secure embedded applications AAETC2v00 Architecture 33 • Secure design based on existing ARM core designs (ARM7, Cortex- M3) – Synthesizable, fully static design – Secure Memory Protection Unit – Thumb support for code density – Specific and unique anti- counterfeiting design features – Small and power-efficient
  • 34. AGENDA Introduction to ARM and the Architecture Processor Families • Programmer’s Model AAETC2v00 Architecture 34 • Programmer’s Model Exceptions and Interrupts
  • 35. ARM PROCESSOR MODES Mode Description Supervisor (SVC) Entered on reset and when a Supervisor call instruction (SVC) is executed FIQ Entered when a high priority (fast) interrupt is raised IRQ Entered when a normal priority interrupt is raised Exceptionmodes AAETC2v00 Architecture 35 Privileged modes Abort Used to handle memory access violations Undef Used to handle undefined instructions Hyp Used for hardware virtualization support Monitor Used for TrustZone secure monitor program System Privileged mode using the same registers as User mode User Mode under which most Applications / OS tasks run Unprivileged mode Exceptionmodes Cortex-A15/A7only Same registerbank
  • 36. ARM REGISTER SET • General purpose registers r0-r12 r13 (sp) r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r8 r9 r10 r11 Banked registers AAETC2v00 Architecture 36 r14 (lr) r15 (pc) cpsr spsr User IRQ FIQ Undef Abort r11 r12 r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) r11 r12 r13 (sp) r14 (lr) spsr spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) SVC PSR
  • 37. REGISTER SET BEHAVIOR ON EXCEPTIONS User moder0 r1 r2 r3 r4 r5 r6 r7 r8 r8 FIQ mode r0 r1 r2 r3 r4 r5 r6 r7 r8 r8 Registers in use Registers in use AAETC2v00 Architecture 37 r8 r9 r10 r11 r12 r15 (pc) cpsr r13 (sp) r14 (lr) r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr FIQ EXCEPTION r8 r9 r10 r11 r12 r15 (pc) cpsr r13 (sp) r14 (lr) r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr Return address calculated from User mode PC value and stored in FIQ mode LR User mode CPSR copied to FIQ mode SPSR
  • 38. INSTRUCTION SET • ARM instruction set – All instructions are 32-bit – Most instructions can be executed conditionally • Thumb instruction set – 16-bit instruction set No condition execution (except for branches) AAETC2v00 Architecture 38 – 16-bit instruction set – No condition execution (except for branches) – Optimized for code density from C code (~65% of ARM code size) • Thumb-2 technology – Extension to Thumb instruction set – Mix of 16-bit and 32-bit instructions – Condition execution via IT instruction – Higher performance than Thumb and smaller than ARM
  • 39. AGENDA Introduction to ARM and the Architecture Processor Families Programmer’s Model AAETC2v00 Architecture 39 Programmer’s Model • Exceptions and Interrupts
  • 40. EXCEPTION BASICS • Recall modes and registers… AAETC2v00 Architecture 40
  • 41. ENTRY/EXIT SEQUENCE Save processor status Copies CPSR into SPSR_<mode> Stores the return address in LR_<mode> Change processor status for exception Mode field bits ARM or Thumb (T2) state Interrupt disable bits (if appropriate) Save Regs (r1~r12) in stacks (if necessary) Exception handling code Restore Regs from stacks Applicationcode AAETC2v00 Architecture 41 Interrupt disable bits (if appropriate) Sets PC to vector address Restore CPSR from SPSR_<mode> Restore PC from LR_<mode> Restore Regs from stacks (if necessary)> Automatic processor actions Handler code Applicationcode
  • 42. ENTRY/EXIT INSTRUCTIONS There are three ways of doing this… 1. Use a data processing instruction To return from an exception, you must… 1. Restore CPSR from SPSR 2. Restore PC from LR This must be done atomically AAETC2v00 Architecture 42 1. Use a data processing instruction MOVS PC, LR SUBS PC, LR, #4 2. Use an LDM instruction LDMFD sp! {pc}^ 3. Use a dedicated exception return instruction SRSFD sp!, #mode ; Save SPSR and LR to stack of specified mode RFEFD sp! ; Restore PC and CPSR from current mode stack ^
  • 43. LINK REGISTER ADJUSTMENTS • On taking an exception … … the link register (LR_<mode>) is automatically populated with the return address • Before returning … … the link register must be adjusted, depending on the exception type Exception Adjustment Instruction returned to AAETC2v00 Architecture 43 Exception Adjustment Instruction returned to SVC 0 Next instruction Undef 0 Next instruction Prefetch Abort -4 Aborting instruction Data Abort -8 Aborting instruction if precise FIQ -4 Next instruction IRQ -4 Next instruction Note that there is no defined method of returning from a reset exception!
  • 44. VECTOR TABLE • Location of vector table – Default to 0x00000000 – Can be relocated to 0xffff0000 in HIVECS mode • Configurable via V bit of CP15 System Control Register • Determined by VINITHI signal at reset Vectors AAETC2v00 Architecture 44 • Content of vector table for Cortex-A/R processors – A branch instruction • Easy to use if handlers are within range – LDR pc, […] • More dynamic vector table • Range is unlimited within address space Vectors LDR PC, Reset_Addr LDR PC, Undefined_Addr LDR PC, SVC_Addr LDR PC, Prefetch_Addr LDR PC, Abort_Addr NOP ; Reserved vector LDR PC, IRQ_Addr LDR PC, FIQ_Addr Reset_Addr DCD Reset_Handler Undefined_Addr DCD Undefined_Handler SVC_Addr DCD SVC_Handler Prefetch_Addr DCD Prefetch_Handler Abort_Addr DCD Abort_Handler IRQ_Addr DCD IRQ_Handler FIQ_Addr DCD FIQ_Handler
  • 45. INTERRUPTS AND INTERRUPT CONTROLLERS • Most systems use an interrupt controller ARM926EJ-SInterrupt sources nFIQ Interrupt Controller nIRQ AAETC2v00 Architecture 45 Most systems use an interrupt controller – Prioritization and pre-emption – Automatic vectoring in most cases – Generally used for IRQ only • IRQ/FIQ and their difference – R8-R12 are banked in FIQ – FIQ has higher priority than IRQ – IRQ is disabled by processor when entering all exceptions. FIQ is disabled by processor only when entering Reset/FIQ exception
  • 46. SIMPLE EXCEPTION HANDLING Save context (on stack) Identify Interrupt resource IRQ automatically disabled AAETC2v00 Architecture 46 Assembler handler Applicationcode Call C handler Clear Interrupt resource Restore context and return C handler IRQ automatically re-enabled
  • 47. RE-ENABLING INTERRUPTS • There are two ways to enable/disable interrupts Modify CPSR Use CPS instruction MSR r0, CPSR CPSID i AAETC2v00 Architecture 47 MSR r0, CPSR BIC r0, #I_bit MRS CPSR_c, r0 CPSID i Works on all architectures Uses read-modify-write so may need to be careful Works on ARMv6 and later Atomic operation Can also change mode
  • 48. RE-ENABLING INTERRUPTS • Once IRQ is re-enabled, IRQ handlers must be re-entrant • Problem A fresh interrupt could occur at any time This would cause the processor to store the return address of the new interrupt in LR_IRQ Unless the programmer is careful, this will over-write the original return address This will cause a program failure AAETC2v00 Architecture 48 This will cause a program failure • Solution The interrupt handler must store LR and SPSR (usually on the stack) To prevent over-write of LR, the handler must change to another privileged mode This must be done before re-enabling interrupts Before exist, the handler must restore LR and SPSR Note that a DSB instruction may be required before re-enabling interrupts to ensure that the interrupt condition is cleared
  • 49. RE-ENTRANT EXCEPTION HANDLING Save LR, SPSR (on SVC stack) Switch to SVC mode Save {r0-r3, r12} to stack Identify interrupt source IRQ automatically disabled AAETC2v00 Architecture 49 Assembler handler Applicationcode Identify interrupt source Enable IRQ C handler IRQ automatically re-enabled Call C handler Disable IRQ Restore {r0-r3,r12} from stack Return from SVC stack
  • 50. SVC EXCEPTION • SVC instruction (previously called SWI) – Thumb SVC instruction, containing 8-bit SVC number – SVC 0x12 – ARM SVC instruction, containing 24-bit SVC number – SVC 0x123456 15 8 7 0 Op Code SWI number AAETC2v00 Architecture 50 – SVC 0x123456 • What SVC is used for? – Implementing system call to enable user mode application calling privilege – Semihosting (discuss later) 2831 2427 0 Cond Op Code SWI number 23
  • 51. SVC EXAMPLE App Glibc User Space SVC SVC AAETC2v00 Architecture 51 System Call Interface Kernel Architecture dependent Code Hardware Kernel Space
  • 52. ABORT EXCEPTIONS • Aborts are caused by – Bus error (external fault) – Permission violation (internal fault) – Virtual address translation failure (internal fault) • There are two kinds of abort – Data abort AAETC2v00 Architecture 52 – Data abort • Caused by a memory or permission error on a data access – Prefetch abort • Caused by an error on an instruction fetch • Instruction is flagged in the fetch stage • Abort is taken if the instruction reaches the execution stage • Aborts may be precise or imprecise – For a precise abort, the instruction causing the abort can be identified – For an imprecise abort, this is not the case – Imprecise aborts are usually fatal (to the system or process)
  • 53. ABORT EXAMPLES • Examples of synchronous abort – Attempt to access privileged memory in User mode – Unaligned access in Strongly Ordered or Device memory – Unaligned access when A bit in System Control Register is set • Examples of Asynchronous abort AAETC2v00 Architecture 53 • Examples of Asynchronous abort – Write which uses write bufffer – Cache cast-out of dirty data • Abort status information – Abort status is stored in IFSR (for prefetch) or DFSR (for data) – Abort address is stored in IFAR or DFAR – DFAR contains an undefined value in the case of an imprecise abort
  • 54. ABORT MODEL • The “Abort Model” defines the value left in the base register for auto- update addressing modes • For example, if the following instruction causes an abort… LDR r0, [r3], #4 …what value will be in r3 on entry to the abort handler? AAETC2v00 Architecture 54 • ARMv7 cores implement a “base-restored” abort model • This ensures that the original, unchanged value is left in the base register • Earlier cores (prior to ARM9) implement a “base-updated” abort model • This leaves the updated value in the base register • For these cores, the abort handler must contain code to determine and reverse any update to the base register
  • 55. UNDEF EXCEPTION • There are several possible causes for an Undefined Instruction exception – An invalid instruction encoding • This usually indicates a fatal condition e.g. attempting to execute data – The targeted coprocessor is not available • The exception handler may be capable of emulating the coprocessor function AAETC2v00 Architecture 55 • This is often used for soft FP emulation on systems with no FP hardware support – The targeted coprocessor is not enabled or is powered down • The exception handler can enable (or power up) the coprocessor and then return to retry the failed instruction • This mechanism is sometimes used by Operating Systems to implement “lazy context switching” – A coprocessor is configured for Privileged or Secure access only • The action will be system-dependent as it may indicate an attempt by a malicious process to subvert system security
  • 56. SOFTWARE & SYSTEMS DESIGN 2 - Architecture