You copied the Doc URL to your clipboard.

13.65 MRS (PSR to general-purpose register)

Move the contents of a PSR to a general-purpose register.

Syntax

MRS{cond} Rd, psr

where:

cond

is an optional condition code.

Rd

is the destination register.

psr

is one of:

APSR

on any processor, in any mode.

CPSR

deprecated synonym for APSR and for use in Debugstate, on any processor except ARMv7-M and ARMv6-M.

SPSR

on any processor except ARMv7-M and ARMv6-M, inprivileged software execution only.

Mpsr

on ARMv7-M and ARMv6-M processors only.

Mpsr

can be any of: IPSR, EPSR, IEPSR, IAPSR, EAPSR, MSP, PSP, XPSR, PRIMASK, BASEPRI, BASEPRI_MAX, FAULTMASK,or CONTROL.

Usage

Use MRS in combination with MSR aspart of a read-modify-write sequence for updating a PSR, for exampleto change processor mode, or to clear the Q flag.

In process swap code, the programmers’ model state of theprocess being swapped out must be saved, including relevant PSRcontents. Similarly, the state of the process being swapped in mustalso be restored. These operations make use of MRS/storeand load/MSR instruction sequences.

SPSR

You must not attempt to access the SPSR when the processoris in User or System mode. This is your responsibility. The assemblercannot warn you about this, because it has no information aboutthe processor mode at execution time.

CPSR

ARM deprecates reading the CPSR endianness bit (E) with an MRS instruction.

The CPSR execution state bits, other than the E bit, can onlybe read when the processor is in Debug state, halting debug-mode.Otherwise, the execution state bits in the CPSR read as zero.

The condition flags can be read in any mode on any processor. Use APSR if you are only interested in accessing the condition flags in User mode.

Register restrictions

You cannot use PC for Rd in A32 instructions. You can use SP for Rd in A32 instructions but this is deprecated.

You cannot use PC or SP for Rd in T32 instructions.

Condition flags

This instruction does not change the flags.

Architectures

This instruction is available in A32 and T32.

There is no 16-bit version of this instruction in T32.

Was this page helpful? Yes No