Saturday, September 5, 2020

ARM Exceptions - Part 1

What are Exceptions ?

An exception is any condition that requires the core to halt normal execution and instead execute a dedicated software routine known as an exception handler associated with each exception type.Exceptions are conditions or system events that usually requires remedial action or an update of  system status by privileged software to ensure smooth functioning of the system. This is called handling an exception. When the exception has been handled, privileged software prepares the core to resume whatever it was doing before taking the exception. Exceptions are normally synchronous in nature however the occurrence of IRQ and FIQ interrupts are not directly related to the software being executed by the core at any given time, they are classified as asynchronous exceptions.

Aborts can be generated either on failed instruction fetches (prefetch aborts) or failed data accesses (data aborts). They can come from the external memory system giving an error response on a memory access (indicating perhaps that the specified address does not correspond to real memory in the system).

Alternatively, the abort can be generated by the Memory Management Unit(MMU) of the core. An operating system can use MMU aborts to dynamically allocate memory to applications.

Asynchronous(imprecise) and Synchronous(precise) Abort 

An Abort is described as synchronous if it is generated as a result of execution or attempted execution of the instruction stream, and where the return address will provide details of the instruction that caused it. Aborts generated by the MMU are always synchronous in nature.

An Asynchronous abort is NOT generated by executing instructions, while the return address might not always provide details of what caused the abort. The occurrence of IRQ and FIQ interrupts are not directly related to the software being executed by the core at any given time, they are classified as asynchronous exceptions.

Synchronous exceptions can occur for a number of possible reasons:

• Aborts from the MMU. For example, permission failures or memory areas marked as Access flag fault.

• SP and PC alignment checking.

• Unallocated instructions.

• Service Calls (SVCs, SMCs and HVCs).

Exception generating instructions

Execution of certain instructions can generate exceptions. Such instructions are typically executed to request a service from software that runs at a higher

Privilege level

• The Supervisor Call (SVC) instruction enables User mode programs to request an Operating System service.

• The Hypervisor Call (HVC) instruction, available if the Virtualization Extensions are implemented, enables the guest OS to request Hypervisor services.

• The Secure Monitor Call (SMC) instruction, available if the Security Extensions are implemented, enables the Normal world to request Secure world services.


No comments:

Post a Comment