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.

A9.1.2 Null checking<br />

ThumbEE<br />

A null check is performed for all load/store instructions when they are executed in ThumbEE state. If the<br />

value in the base register is zero, execution branches to the NullCheck h<strong>and</strong>ler at H<strong>and</strong>lerBase – 4.<br />

For most load/store instructions, this is the only difference from normal Thumb operation. Exceptions to<br />

this rule are described in this chapter.<br />

Note<br />

The null check examines the value in the base register, not any calculated value offset from the base<br />

register.<br />

If the base register is the SP or the PC, a zero value in the base register results in UNPREDICTABLE<br />

behavior.<br />

The instructions affected by null checking are:<br />

all instructions whose mnemonic starts with LD, ST, VLD or VST<br />

POP, PUSH, TBB, TBH, VPOP, <strong>and</strong> VPUSH.<br />

For each of these instructions, the pseudocode shown in the Operation section uses the following function:<br />

// NullCheckIfThumbEE()<br />

// ====================<br />

NullCheckIfThumbEE(integer n)<br />

if CurrentInstrSet() == InstrSet_ThumbEE then<br />

if n == 15 then<br />

if IsZero(Align(PC,4)) then UNPREDICTABLE;<br />

elsif n == 13 then<br />

if IsZero(SP) then UNPREDICTABLE;<br />

else<br />

if IsZero(R[n]) then<br />

LR = PC : ‘1’; // PC holds this instruction’s address plus 4<br />

BranchWritePC(TEEHBR - 4);<br />

EndOfInstruction();<br />

return;<br />

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

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

Saved successfully!

Ooh no, something went wrong!