If the pc is not in the register list and the s bit

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t;cond>}<add mode> Rn, <registers - pc>~ Here the register list must not contain the PC and write-back is not Examples allowed. To save three work registers and the return address upon entering a subroutine: STMFD r13!, {r0-r2, r14} This assumes that r13 has been initialized for use as a stack pointer. To restore the work registers and return: LDMFD r13!, pc} {r0-r2, 132 The ARM Instruction Set Notes 1. If the PC is specified in the register list in a store multiple instruction, the value saved is implementation dependent. Normally, therefore, specifying the PC in an STM should be avoided. (Loading the PC has the expected result and is a stand ard way of returning from a procedure.) 2. The base register may be specified in the transfer list of either a load or store mul tiple, but write-back should not be specified in the same instruction since the result of doing so is unpredictable. 3. If the base register contains an address that is not word-aligned, the bottom two bits will be ignored. Some ARM systems may generate an exception. 4. In architecture v5T only, the bottom bit of a loaded PC updates the Thumb bit. 5.13 Swap memory and register instructions (SWP) Swap instructions combine a load and a store of a word or an unsigned byte in a single instruction. Normally the two transfers are combined into an atomic memory operation that cannot be split by an external memory access (for instance from a DMA controller), and therefore the instruction can be used as the basis of a semaphore mechanism to give mutually exclusive access to data structures that are shared between multiple processes, processors, or a processor and a DMA controller. These instructions are little used outside their role in the construction of semaphores. Binary encoding Figure 5.12 Swap memory and register instruction binary encoding. Description The instruction loads the word (B = 0) or unsigned byte (B = 1) at the memory location addressed by Rn into Rd, and stores the same data type from Rm into the same...
View Full Document

This document was uploaded on 10/30/2011 for the course CSE 378 380 at SUNY Buffalo.

Ask a homework question - tutors are online