4.10.2. MRS

Move the contents of the CPSR or SPSR to a general-purpose register.

Syntax

MRS{cond} Rd, psr

where:

cond

is an optional condition code (see Conditional execution).

Rd

is the destination register. Rd must not be r15.

psr

is either CPSR or SPSR.

Usage

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

Caution

You must not attempt to access the SPSR when the processor is in User or System mode. This is your responsibility. The assembler cannot warn you about this because it does not know in what processor mode the code will be executed.

Condition flags

This instruction does not affect the flags.

Architectures

MRS is available in ARMv3 and above.

Example

    MRS r3, SPSR
Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0231B
Non-Confidential