13.07.2015 Views

PDF version - ARM Information Center

PDF version - ARM Information Center

PDF version - ARM Information Center

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.

Migrating a software applicationSystem mode (the first CPS instruction). All registers (including the return address andSPSR) are saved on the System mode stack (this is shared with User mode).The <strong>ARM</strong> ABI requires (as does the Power ABI) that the stack pointer is doublewordalignedat public boundaries so exception handlers must check and, if necessary, correctthe alignment of the stack prior to making any external function calls.4.5.2 Vector table generationIn both architectures, the vector table consists of executable instructions (rather than theaddresses found in many other systems). As explained in 3.3.4 above, the PPC vectortable entries are spaced out at 16-byte intervals, offering the possibility of writing verysimple handlers (or, at least, the first part of more complex ones) in place in the vectortable itself. <strong>ARM</strong>, having a contiguous list of word-sized entries, offers this possibility onlyin the case of FIQ. The vector for FIQ is the last in the table, so the handler for FIQ can belocated to start at this address and run contiguously from that point.The <strong>ARM</strong> vector table is shown in section 3.3.4 above.Each entry in the vector table typically consists of a branch instruction pointing to the startof the relevant exception handler. For a “small” application (i.e. one in which the exceptionhandlers are within direct branch range of the vector table), branch instructions can beused.startAREA Vectors, CODE, READONLYIMPORT Reset_Handler; import other exception handlers; …ENTRYBBBBBNOPBReset_HandlerUndefined_HandlerSWI_HandlerPrefetch_HandlerData_Handler; Reserved vectorIRQ_Handler; FIQ_Handler will follow directlyENDAs shown, the vector table is typically placed in a named section of its own so that it canbe explicitly located at link-time.For larger systems, it is common to use a direct load to the program counter in each caseand to place the handler addresses in a small data table near the handler. This methodhas other advantages – in particular it makes it much easier to modify the vectors at runtime by simply re-writing the data table.Application Note 245 Copyright © 2012 <strong>ARM</strong> Limited. All rights reserved. 29<strong>ARM</strong> DAI 0245B

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

Saved successfully!

Ooh no, something went wrong!