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.

The System Level Programmers’ Model<br />

the subsequent instruction, if the instruction that caused the exception has been emulated in the<br />

exception h<strong>and</strong>ler.<br />

The <strong>ARM</strong> architecture makes no requirement that exception return must be to any particular place in the<br />

execution stream. However, the architecture does have a preferred exception return for each exception other<br />

than Reset. The values of the SPSR.IT[7:0] bits generated on exception entry are always correct for the<br />

preferred exception return, but might require adjustment by software if returning elsewhere.<br />

In some cases, the value of the LR set on taking the exception, as shown in Table B1-4 on page B1-34,<br />

makes it necessary to perform a subtraction to calculate the appropriate return address. The value that must<br />

be subtracted for the preferred exception return, <strong>and</strong> other details of the preferred exception return, are given<br />

in the description of each of the exceptions.<br />

The <strong>ARM</strong> architecture provides the following exception return instructions:<br />

Data-processing instructions with the S bit set <strong>and</strong> the PC as a destination, see SUBS PC, LR <strong>and</strong><br />

related instructions on page B6-25.<br />

Typically, SUBS is used when a subtraction is required, <strong>and</strong> SUBS with an oper<strong>and</strong> of 0 or MOVS is used<br />

otherwise.<br />

From <strong>ARM</strong>v6, the RFE instruction, see RFE on page B6-16. If a subtraction is required, typically it is<br />

performed before saving the LR value to memory.<br />

In <strong>ARM</strong> state, a form of the LDM instruction, see LDM (exception return) on page B6-5. If a<br />

subtraction is required, typically it is performed before saving the LR value to memory.<br />

Alignment of exception returns<br />

An unaligned exception return is one where the address transferred to the PC on an exception return is not<br />

aligned to the size of instructions in the target instruction set. The target instruction set is controlled by the<br />

[J,T] bits of the value transferred to the CPSR for the exception return. The behavior of the hardware for<br />

exception returns for different values of the [J,T] bits is as follows:<br />

[J,T] == 00 The target instruction set state is <strong>ARM</strong> state. Bits [1:0] of the address transferred to the PC<br />

are ignored by the hardware.<br />

[J,T] == 01 The target instruction set state is Thumb state:<br />

bit [0] of the address transferred to the PC is ignored by the hardware<br />

bit [1] of the address transferred to the PC is part of the instruction address.<br />

[J,T] == 10 The target instruction set state is Jazelle state. In a non-trivial implementation of the Jazelle<br />

extension, bits [1:0] of the address transferred to the PC are part of the instruction address.<br />

In a trivial implementation of the Jazelle extension, behavior is UNPREDICTABLE, see<br />

Exception return to an unsupported instruction set state on page B1-40. For details of the<br />

trivial implementation of Jazelle state see Trivial implementation of the Jazelle extension on<br />

page B1-81.<br />

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

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

Saved successfully!

Ooh no, something went wrong!