
ARM Instruction Set - MRS, MSR
ARM7TDMI Data Sheet
ARM DDI 0029E
4-18
O
4.6
PSR Transfer (MRS, MSR)
The instruction is only executed if the condition is true. The various conditions are
defined in
·
Table 4-2: Condition code summary
on page 4-5.
The MRS and MSR instructions are formed from a subset of the Data Processing
operations and are implemented using the TEQ, TST, CMN and CMP instructions
without the S flag set. The encoding is shown in
·
Figure 4-11: PSR transfer
on page
4-19.
These instructions allow access to the CPSR and SPSR registers. The MRS
instruction allows the contents of the CPSR or SPSR_<mode> to be moved to a
general register. The MSR instruction allows the contents of a general register to be
moved to the CPSR or SPSR_<mode> register.
The MSR instruction also allows an immediate value or register contents to be
transferred to the condition code flags (N,Z,C and V) of CPSR or SPSR_<mode>
without affecting the control bits. In this case, the top four bits of the specified register
contents or 32 bit immediate value are written to the top four bits of the relevant PSR.
4.6.1 Operand restrictions
In User mode, the control bits of the CPSR are protected from change, so only
the condition code flags of the CPSR can be changed. In other (privileged)
modes the entire CPSR can be changed.
Note that the software must never change the state of the T bit in the CPSR.
If this happens, the processor will enter an unpredictable state.
The SPSR register which is accessed depends on the mode at the time of
execution. For example, only SPSR_fiq is accessible when the processor is in
FIQ mode.
You must not specify R15 as the source or destination register.
Also, do not attempt to access an SPSR in User mode, since no such register
exists.