EasyManua.ls Logo

ARM Cortex-M4 - Mrs

ARM Cortex-M4
276 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The Cortex-M4 Instruction Set
ARM DUI 0553A Copyright © 2010 ARM. All rights reserved. 3-163
ID121610 Non-Confidential
3.12.6 MRS
Move the contents of a special register to a general-purpose register.
Syntax
MRS{cond} Rd, spec_reg
where:
cond
Is an optional condition code, see Conditional execution on page 3-18.
Rd
Specifies the destination register.
spec_reg
Can be any of:
APSR
,
IPSR
,
EPSR
,
IEPSR
,
IAPSR
,
EAPSR
,
PSR
,
MSP
,
PSP
,
PRIMASK
,
BASEPRI
,
BASEPRI_MAX
,
FAULTMASK
, or
CONTROL
.
Note
All the
EPSR
and
IPSR
fields are zero when read by the
MRS
instruction.
Operation
Use
MRS
in combination with
MSR
as part of a read-modify-write sequence for updating a PSR,
for example to clear the Q flag.
In process swap code, the programmers model state of the process being swapped out must be
saved, including relevant PSR contents. Similarly, the state of the process being swapped in
must also be restored. These operations use
MRS
in the state-saving instruction sequence and
MSR
in the state-restoring instruction sequence.
Note
BASEPRI_MAX
is an alias of
BASEPRI
when used with the
MRS
instruction.
See MSR on page 3-164.
Restrictions
Rd
must not be SP and must not be PC.
Condition flags
This instruction does not change the flags.
Examples
MRS R0, PRIMASK ; Read PRIMASK value and write it to R0

Table of Contents

Related product manuals