2 mrs – ARM VERSION 1.2 User Manual

Page 183

Advertising
background image

ARM Instruction Reference

ARM DUI 0068B

Copyright © 2000, 2001 ARM Limited. All rights reserved.

4-73

4.8.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 on page 4-4).

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 as it does not
know what processor mode code will be executed in.

Condition flags

This instruction does not affect the flags.

Architectures

This instruction is available in ARM architecture versions 3 and above.

Example

MSR r3, SPSR

Advertising