Page 119 - ARM 64 Bit Assembly Language
P. 119

Data processing and other instructions 105

                     4.3.2 Accessing the PSTATE register

                     These two instructions allow the programmer to access the status bits of the CPSR and SPSR:

                     mrs     Move Status to Register, and
                     msr     Move Register to Status.

                     4.3.2.1 Syntax

                          mrs       Xt, <field>
                          msr       <field>, Xt


                     •   The optional <fields> is any one of:
                          NZCV          Condition Flags
                          DAIF          Interrupt Bits
                          CurrentEL     Current Exception Level
                          PAN           Privileged Access Never (ARMv8.1 only)
                          UAO           User Access Override (ARMv8.2-UAO only)
                     •   The optional <cond> can be any of the codes from Table 3.2 specifying conditional exe-
                         cution.


                     4.3.2.2 Operations

                       Name     Effect                               Description
                       mrs      Xt ← PSTATE                          Move from Process State.
                       msr      PSTATE ← Xt                          Move to Process State.

                     4.3.2.3 Examples

                     nzcv is the only PSTATE field guaranteed to be accessible at the lowest execution state, EL0,
                     which is unprivileged and where applications are intended to be run:

                    1         mrs    x0, NZCV        // Read the NZCV flags into r0
                    2         and    x0, xzr, x0     // Clear the flags
                    3         msr    NZCV, x0        // Write the flags back


                     4.3.3 Supervisor call

                     The following instruction allows a user program to perform a system call to request operating
                     system services:
   114   115   116   117   118   119   120   121   122   123   124