<?xml-stylesheet type="text/xsl" encoding="UTF-8" href="iform.xsl" version="1.0"?>
<!DOCTYPE instructionsection PUBLIC "-//ARM//DTD instructionsection //EN" "iform-p.dtd">
<!-- Copyright (c) 2010-2025 Arm Limited or its affiliates. All rights reserved. -->
<!-- This document is Non-Confidential. This document may only be used and distributed in accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this document to. -->
<instructionsection id="MSR_imm" title="MSR (immediate) -- A64" type="instruction">
  <docvars>
    <docvar key="instr-class" value="system"/>
    <docvar key="isa" value="A64"/>
    <docvar key="mnemonic" value="MSR"/>
    <docvar key="msr-sysreg-target" value="whole-register"/>
  </docvars>
  <heading>MSR (immediate)</heading>
  <desc>
    <brief>
      <para>Move immediate value to special register</para>
    </brief>
    <authored>
      <para>This instruction moves an immediate value to
selected bits of the PSTATE. For more information, see
<xref linkend="ARMARM_PSTATE">Process state, PSTATE</xref>.</para>
      <para>The bits that can be written by this instruction are:</para>
      <list type="unordered">
        <listitem>
          <content>PSTATE.D, PSTATE.A, PSTATE.I, PSTATE.F, and PSTATE.SP.</content>
        </listitem>
        <listitem>
          <content>If <xref linkend="ARMARM_FEAT_SSBS">FEAT_SSBS</xref> is implemented, PSTATE.SSBS.</content>
        </listitem>
        <listitem>
          <content>If <xref linkend="ARMARM_FEAT_PAN">FEAT_PAN</xref> is implemented, PSTATE.PAN.</content>
        </listitem>
        <listitem>
          <content>If <xref linkend="ARMARM_FEAT_UAO">FEAT_UAO</xref> is implemented, PSTATE.UAO.</content>
        </listitem>
        <listitem>
          <content>If <xref linkend="ARMARM_FEAT_DIT">FEAT_DIT</xref> is implemented, PSTATE.DIT.</content>
        </listitem>
        <listitem>
          <content>If <xref linkend="ARMARM_FEAT_MTE">FEAT_MTE</xref> is implemented, PSTATE.TCO.</content>
        </listitem>
        <listitem>
          <content>If <xref linkend="ARMARM_FEAT_NMI">FEAT_NMI</xref> is implemented, PSTATE.ALLINT.</content>
        </listitem>
        <listitem>
          <content>If <xref linkend="ARMARM_FEAT_SME">FEAT_SME</xref> is implemented, PSTATE.SM and PSTATE.ZA.</content>
        </listitem>
        <listitem>
          <content>If FEAT_EBEP is implemented, PSTATE.PM.</content>
        </listitem>
      </list>
      <para>If <xref linkend="ARMARM_FEAT_MTE">FEAT_MTE</xref> is implemented and <xref linkend="ARMARM_FEAT_MTE2">FEAT_MTE2</xref>
is not implemented, it is <arm-defined-word>IMPLEMENTATION DEFINED</arm-defined-word>
whether writes to PSTATE.TCO by this instruction are ignored.</para>
    </authored>
  </desc>
  <alias_list howmany="2">
    <alias_list_intro>This instruction is used by the aliases </alias_list_intro>
    <aliasref aliaspageid="SMSTART_MSR_imm" aliasfile="smstart_msr_imm.xml" hover="Enables access to Streaming SVE mode and SME architectural state" punct=" and ">
      <text>SMSTART</text>
      <aliaspref>op1 == '011' &amp;&amp; CRm IN {'0xx1'} &amp;&amp; op2 == '011'</aliaspref>
    </aliasref>
    <aliasref aliaspageid="SMSTOP_MSR_imm" aliasfile="smstop_msr_imm.xml" hover="Disables access to Streaming SVE mode and SME architectural state" punct=".">
      <text>SMSTOP</text>
      <aliaspref>op1 == '011' &amp;&amp; CRm IN {'0xx0'} &amp;&amp; op2 == '011'</aliaspref>
    </aliasref>
    <alias_list_outro>
      <text>  See </text>
      <aliastablelink/>
      <text> below for details of when each alias is preferred.</text>
    </alias_list_outro>
  </alias_list>
  <classes>
    <iclass name="System" oneof="1" id="iclass_system" no_encodings="1" isa="A64">
      <docvars>
        <docvar key="instr-class" value="system"/>
        <docvar key="isa" value="A64"/>
        <docvar key="mnemonic" value="MSR"/>
        <docvar key="msr-sysreg-target" value="whole-register"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="32" psname="A64.control.pstate.MSR_SI_pstate" tworows="1">
        <box hibit="31" width="3" settings="3">
          <c>1</c>
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="28" width="3" settings="3">
          <c>1</c>
          <c>0</c>
          <c>1</c>
        </box>
        <box hibit="25" width="7" settings="7">
          <c>0</c>
          <c>1</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="18" width="3" name="op1" usename="1">
          <c colspan="3"/>
        </box>
        <box hibit="15" width="4" settings="4">
          <c>0</c>
          <c>1</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="11" width="4" name="CRm" usename="1">
          <c colspan="4"/>
        </box>
        <box hibit="7" width="3" name="op2" usename="1">
          <c colspan="3"/>
        </box>
        <box hibit="4" width="5" name="Rt" usename="1" settings="5" psbits="xxxxx">
          <c>1</c>
          <c>1</c>
          <c>1</c>
          <c>1</c>
          <c>1</c>
        </box>
      </regdiagram>
      <encoding name="MSR_SI_pstate" oneofinclass="1" oneof="1" label="" bitdiffs="!(op1 == 000 &amp;&amp; op2 IN {00x, 010})">
        <docvars>
          <docvar key="instr-class" value="system"/>
          <docvar key="isa" value="A64"/>
          <docvar key="msr-sysreg-target" value="whole-register"/>
          <docvar key="mnemonic" value="MSR"/>
        </docvars>
        <asmtemplate><text>MSR  </text><a hover="Is a PSTATE field name. For the MSR instruction, this is " link="pstatefield_option">&lt;pstatefield&gt;</a><text>, #</text><a hover="Is a 4-bit unsigned immediate, in the range 0 to 15, encoded in the &quot;CRm&quot; field. Restricted to the range 0 to 1, encoded in &quot;CRm&lt;0&gt;&quot;, when &lt;pstatefield&gt; is ALLINT, PM, SVCRSM, SVCRSMZA, or SVCRZA." link="msr_imm">&lt;imm&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A64.control.pstate.MSR_SI_pstate" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">if op1 == '000' &amp;&amp; op2 == '000' then See("CFINV"); end;
if op1 == '000' &amp;&amp; op2 == '001' then See("XAFLAG"); end;
if op1 == '000' &amp;&amp; op2 == '010' then See("AXFLAG"); end;

var min_EL : bits(2);
var need_secure : boolean = FALSE;

case op1 of
    when '00x' =&gt;
        min_EL = EL1;
    when '010' =&gt;
        min_EL = EL1;
    when '011' =&gt;
        min_EL = EL0;
    when '100' =&gt;
        min_EL = EL2;
    when '101' =&gt;
        if !IsFeatureImplemented(FEAT_VHE) then EndOfDecode(Decode_UNDEF); end;
        min_EL = EL2;
    when '110' =&gt;
        min_EL = EL3;
    when '111' =&gt;
        min_EL = EL1;
        need_secure = TRUE;
end;

let operand : bits(4) = CRm;
var field : PSTATEField;
case op1::op2 of
    when '000 011' =&gt;
        if !IsFeatureImplemented(FEAT_UAO) then EndOfDecode(Decode_UNDEF); end;
        field = PSTATEField_UAO;
    when '000 100' =&gt;
        if !IsFeatureImplemented(FEAT_PAN) then EndOfDecode(Decode_UNDEF); end;
        field = PSTATEField_PAN;
    when '000 101' =&gt; field = PSTATEField_SP;
    when '001 000' =&gt;
        case CRm of
            when '000x' =&gt;
                if !IsFeatureImplemented(FEAT_NMI) then EndOfDecode(Decode_UNDEF); end;
                field = PSTATEField_ALLINT;
            when '001x' =&gt;
                if !IsFeatureImplemented(FEAT_EBEP) then EndOfDecode(Decode_UNDEF); end;
                field = PSTATEField_PM;
            otherwise =&gt;
                EndOfDecode(Decode_UNDEF);
        end;
    when '011 010' =&gt;
        if !IsFeatureImplemented(FEAT_DIT) then EndOfDecode(Decode_UNDEF); end;
        field = PSTATEField_DIT;
    when '011 011' =&gt;
        case CRm of
            when '001x' =&gt;
                if !IsFeatureImplemented(FEAT_SME) then EndOfDecode(Decode_UNDEF); end;
                field = PSTATEField_SVCRSM;
            when '010x' =&gt;
                if !IsFeatureImplemented(FEAT_SME) then EndOfDecode(Decode_UNDEF); end;
                field = PSTATEField_SVCRZA;
            when '011x' =&gt;
                if !IsFeatureImplemented(FEAT_SME) then EndOfDecode(Decode_UNDEF); end;
                field = PSTATEField_SVCRSMZA;
            otherwise =&gt;
                EndOfDecode(Decode_UNDEF);
        end;
    when '011 100' =&gt;
        if !IsFeatureImplemented(FEAT_MTE) then EndOfDecode(Decode_UNDEF); end;
        field = PSTATEField_TCO;
    when '011 110' =&gt; field = PSTATEField_DAIFSet;
    when '011 111' =&gt; field = PSTATEField_DAIFClr;
    when '011 001' =&gt;
        if !IsFeatureImplemented(FEAT_SSBS) then EndOfDecode(Decode_UNDEF); end;
        field = PSTATEField_SSBS;
    otherwise =&gt;      EndOfDecode(Decode_UNDEF);
end;</pstext></ps>
      </ps_section>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="MSR_SI_pstate" symboldefcount="1">
      <symbol link="pstatefield_option">&lt;pstatefield&gt;</symbol>
      <definition encodedin="(CRm :: op1 :: op2)">
        <intro>Is a PSTATE field name. For the MSR instruction, this is </intro>
        <table class="valuetable">
          <tgroup cols="5">
            <thead>
              <row>
                <entry class="bitfield">CRm</entry>
                <entry class="bitfield">op1</entry>
                <entry class="bitfield">op2</entry>
                <entry class="symbol">&lt;pstatefield&gt;</entry>
                <entry class="symbol">Architectural Feature</entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">000</entry>
                <entry class="bitfield">011</entry>
                <entry class="symbol">UAO</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_UAO"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">000</entry>
                <entry class="bitfield">100</entry>
                <entry class="symbol">PAN</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_PAN"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">000</entry>
                <entry class="bitfield">101</entry>
                <entry class="symbol">SPSel</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">000</entry>
                <entry class="bitfield">11x</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">000x</entry>
                <entry class="bitfield">001</entry>
                <entry class="bitfield">000</entry>
                <entry class="symbol">ALLINT</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_NMI"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">001</entry>
                <entry class="bitfield">001</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">001</entry>
                <entry class="bitfield">01x</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">001</entry>
                <entry class="bitfield">1xx</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">010</entry>
                <entry class="bitfield">xxx</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">000</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">001</entry>
                <entry class="symbol">SSBS</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_SSBS"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">010</entry>
                <entry class="symbol">DIT</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_DIT"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">000x</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">011</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">100</entry>
                <entry class="symbol">TCO</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_MTE"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">101</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">110</entry>
                <entry class="symbol">DAIFSet</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">111</entry>
                <entry class="symbol">DAIFClr</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">xxxx</entry>
                <entry class="bitfield">1xx</entry>
                <entry class="bitfield">xxx</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">001x</entry>
                <entry class="bitfield">001</entry>
                <entry class="bitfield">000</entry>
                <entry class="symbol">PM</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_EBEP"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">001x</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">011</entry>
                <entry class="symbol">SVCRSM</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_SME"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">01xx</entry>
                <entry class="bitfield">001</entry>
                <entry class="bitfield">000</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">010x</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">011</entry>
                <entry class="symbol">SVCRZA</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_SME"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">011x</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">011</entry>
                <entry class="symbol">SVCRSMZA</entry>
                <entry class="feature">
                  <arch_variants>
                    <arch_variant feature="FEAT_SME"/>
                  </arch_variants>
                </entry>
              </row>
              <row>
                <entry class="bitfield">1xxx</entry>
                <entry class="bitfield">001</entry>
                <entry class="bitfield">000</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
              <row>
                <entry class="bitfield">1xxx</entry>
                <entry class="bitfield">011</entry>
                <entry class="bitfield">011</entry>
                <entry class="symbol">RESERVED</entry>
                <entry class="feature"/>
              </row>
            </tbody>
          </tgroup>
        </table>
        <after>For the SMSTART and SMSTOP aliases, this is encoded in "CRm&lt;2:1&gt;", where <binarynumber>0b01</binarynumber> specifies SVCRSM, <binarynumber>0b10</binarynumber> specifies SVCRZA, and <binarynumber>0b11</binarynumber> specifies SVCRSMZA.</after>
      </definition>
    </explanation>
    <explanation enclist="MSR_SI_pstate" symboldefcount="1">
      <symbol link="msr_imm">&lt;imm&gt;</symbol>
      <account encodedin="(CRm :: op1 :: op2)">
        <intro>
          <para>Is a 4-bit unsigned immediate, in the range 0 to 15, encoded in the "CRm" field. Restricted to the range 0 to 1, encoded in "CRm&lt;0&gt;", when &lt;pstatefield&gt; is ALLINT, PM, SVCRSM, SVCRSMZA, or SVCRZA.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <aliastablehook anchor="aliasconditions">Alias Conditions</aliastablehook>
  <ps_section howmany="1">
    <ps name="A64.control.pstate.MSR_SI_pstate" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">if UInt(PSTATE.EL) &lt; UInt(min_EL) then Undefined(); end;
if need_secure &amp;&amp; CurrentSecurityState() != SS_Secure then Undefined(); end;

case field of
    when PSTATEField_SSBS =&gt;
        PSTATE.SSBS = operand[0];
    when PSTATEField_SP =&gt;
        PSTATE.SP = operand[0];
    when PSTATEField_DAIFSet =&gt;
        AArch64_CheckDAIFAccess(PSTATEField_DAIFSet);
        PSTATE.D = PSTATE.D OR operand[3];
        PSTATE.A = PSTATE.A OR operand[2];
        PSTATE.I = PSTATE.I OR operand[1];
        PSTATE.F = PSTATE.F OR operand[0];
    when PSTATEField_DAIFClr =&gt;
        AArch64_CheckDAIFAccess(PSTATEField_DAIFClr);
        PSTATE.D = PSTATE.D AND NOT(operand[3]);
        PSTATE.A = PSTATE.A AND NOT(operand[2]);
        PSTATE.I = PSTATE.I AND NOT(operand[1]);
        PSTATE.F = PSTATE.F AND NOT(operand[0]);
    when PSTATEField_PAN =&gt;
        PSTATE.PAN = operand[0];
    when PSTATEField_UAO =&gt;
        PSTATE.UAO = operand[0];
    when PSTATEField_DIT =&gt;
        PSTATE.DIT = operand[0];
    when PSTATEField_TCO =&gt;
        PSTATE.TCO = operand[0];
    when PSTATEField_ALLINT =&gt;
        if (PSTATE.EL == EL1 &amp;&amp; IsHCRXEL2Enabled() &amp;&amp;
              HCRX_EL2().TALLINT == '1' &amp;&amp; operand[0] == '1') then
            AArch64_SystemAccessTrap(EL2, 0x18);
        end;
        PSTATE.ALLINT = operand[0];
    when PSTATEField_SVCRSM =&gt;
        CheckSMEAccess();
        SetPSTATE_SM(operand[0]);
    when PSTATEField_SVCRZA =&gt;
        CheckSMEAccess();
        SetPSTATE_ZA(operand[0]);
    when PSTATEField_SVCRSMZA =&gt;
        CheckSMEAccess();
        SetPSTATE_SM(operand[0]);
        SetPSTATE_ZA(operand[0]);
    when PSTATEField_PM =&gt;
        PSTATE.PM = operand[0];
end;</pstext></ps>
  </ps_section>
  <timestamp>2026-03-12 12:23:09</timestamp>
  <commit_id>2025-09_rel_asl1</commit_id>
</instructionsection>
