05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

new_spsr_value = CPSR;<br />

The System Level Programmers’ Model<br />

// Determine whether this is an external abort to be trapped to Monitor mode.<br />

trap_to_monitor = HaveSecurityExt() && SCR.EA == ‘1’ && IsExternalAbort();<br />

// Enter Abort (‘10111’) or Monitor (‘10110’) mode, <strong>and</strong> ensure Secure state if<br />

// initially in Monitor mode. This affects the banked versions of various registers<br />

// accessed later in the code.<br />

if CPSR.M == ‘10110’ then SCR.NS = ‘0’;<br />

CPSR.M = if trap_to_monitor then ‘10110’ else ‘10111’;<br />

// Write return information to registers, <strong>and</strong> make further CPSR changes: IRQs disabled,<br />

// other interrupts disabled if appropriate, IT state reset, instruction set <strong>and</strong><br />

// endianness to SCTLR-configured values.<br />

SPSR[] = new_spsr_value;<br />

R[14] = new_lr_value;<br />

CPSR.I = ‘1’;<br />

if trap_to_monitor then<br />

CPSR.F = ‘1’; CPSR.A = ‘1’;<br />

else<br />

if !HaveSecurityExt() || SCR.NS == ‘0’ || SCR.AW == ‘1’ then CPSR.A = ‘1’;<br />

CPSR.IT = ‘00000000’;<br />

CPSR.J = ‘0’; CPSR.T = SCTLR.TE; // TE=0: <strong>ARM</strong>, TE=1: Thumb<br />

CPSR.E = SCTLR.EE; // EE=0: little-endian, EE=1: big-endian<br />

// Branch to correct Prefetch Abort vector.<br />

if trap_to_monitor then<br />

BranchTo(MVBAR + 12);<br />

else<br />

BranchTo(ExcVectorBase() + 12);<br />

The preferred exception return from a Prefetch Abort exception is a return to the aborted instruction. Use<br />

the LR <strong>and</strong> SPSR values generated by the exception entry to produce this return by using an exception return<br />

instruction with a subtraction of 4.<br />

For more information, see Exception return on page B1-38.<br />

B1.6.15 Data Abort exception<br />

A Data Abort exception can be generated by:<br />

A synchronous abort on a data read or write memory access. Exception entry is synchronous to the<br />

instruction that generated the memory access.<br />

An asynchronous abort. The memory access that caused the abort can be any of:<br />

— a data read or write access<br />

— an instruction fetch or prefetch<br />

— in a VMSA memory system, a translation table access.<br />

Exception entry occurs asynchronously. It is similar to an interrupt, but uses either Abort mode or<br />

Monitor mode, <strong>and</strong> the associated banked registers. Setting the CPSR.A bit prevents asynchronous<br />

aborts from occurring.<br />

<strong>ARM</strong> DDI 0406B Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. B1-55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!