<?xml version="1.0" ?><?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-2026 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="STTXR" title="STTXR -- A64" type="instruction">
  <docvars>
    <docvar key="address-form" value="base-register"/>
    <docvar key="instr-class" value="general"/>
    <docvar key="isa" value="A64"/>
    <docvar key="mnemonic" value="STTXR"/>
  </docvars>
  <heading>STTXR</heading>
  <desc>
    <brief>
      <para>Store unprivileged exclusive register</para>
    </brief>
    <authored>
      <para>This instruction
stores a 32-bit word or a 64-bit doubleword from a register to
memory if the PE has
exclusive access to the memory address, and returns a status
value of 0 if the
store was successful, or of 1 if no store was performed.
See
<xref linkend="ARMARM_Chdcgdja">Synchronization and semaphores</xref>.</para>
      <para>Explicit Memory  effects produced by the instruction behave as if the instruction was
  executed at EL0 if the <xref linkend="ARMARM_Effective_value">Effective value</xref> of
  PSTATE.UAO is 0 and either:</para>
      <list type="unordered">
        <listitem>
          <content>The instruction is executed at EL1.</content>
        </listitem>
        <listitem>
          <content>The instruction is executed at EL2 when the <xref linkend="ARMARM_Effective_value">Effective value</xref>
  of <register_link id="AArch64-hcr_el2.xml" state="AArch64">HCR_EL2()</register_link>.{E2H, TGE} is '11'.</content>
        </listitem>
      </list>
      <para>Otherwise, the Explicit Memory  effects operate with the restrictions determined by
  the Exception level at which the instruction is executed.</para>
      <note>
        <para>For the purposes of the Exclusives monitors, and the forward progress guarantees for
Load-Exclusive and Store-Exclusive loops, <instruction>STTXR</instruction> is
equivalent to <instruction>STXR</instruction>.</para>
      </note>
      <para>For information about addressing modes, see
<xref linkend="ARMARM_CHDIIIBB">Load/Store addressing modes</xref>.</para>
    </authored>
    <encodingnotes>
      <para><instruction>STTXR</instruction> has the same <arm-defined-word>CONSTRAINED UNPREDICTABLE</arm-defined-word> behavior as <instruction>STXR</instruction>. See <xref linkend="CJAEGDJC">Architectural Constraints on UNPREDICTABLE behaviors</xref>, and particularly <xref linkend="CHDGDCGH">STXR</xref>.</para>
    </encodingnotes>
    <syntaxnotes>
      <para>Aborts and alignment</para>
      <para>If a synchronous Data Abort exception is generated by the execution of this instruction:</para>
      <list type="unordered">
        <listitem>
          <content>Memory is not updated.</content>
        </listitem>
        <listitem>
          <content>
            <syntax>&lt;Ws&gt;</syntax> is not updated.</content>
        </listitem>
      </list>
      <para>Accessing an address that is not aligned to the size of the data being accessed causes an
Alignment fault Data Abort exception to be generated, subject to the following rules:</para>
      <list type="unordered">
        <listitem>
          <content>If <function>AArch64_ExclusiveMonitorsPass()</function> returns TRUE, the exception
  is generated.</content>
        </listitem>
        <listitem>
          <content>Otherwise, it is <arm-defined-word>IMPLEMENTATION DEFINED</arm-defined-word> whether the exception is generated.</content>
        </listitem>
      </list>
      <para>If <function>AArch64_ExclusiveMonitorsPass()</function> returns FALSE and the
memory address, if accessed, would generate a synchronous Data Abort exception, it is
<arm-defined-word>IMPLEMENTATION DEFINED</arm-defined-word> whether the exception is generated.</para>
    </syntaxnotes>
  </desc>
  <operationalnotes>
    <operationalnote>
      <operationalnote_content>
        <para>This instruction is a data-independent-time instruction as described in <xref linkend="ARMARM_BEICCDDAB3">About PSTATE.DIT</xref>.</para>
      </operationalnote_content>
    </operationalnote>
  </operationalnotes>
  <alias_list howmany="0"/>
  <classes>
    <iclass name="No offset" oneof="1" id="iclass_no_offset" no_encodings="2" isa="A64">
      <docvars>
        <docvar key="address-form" value="base-register"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="A64"/>
        <docvar key="mnemonic" value="STTXR"/>
      </docvars>
      <iclassintro count="2"/>
      <arch_variants>
        <arch_variant feature="FEAT_LSUI" name="v9Ap6"/>
      </arch_variants>
      <regdiagram form="32" psname="A64.ldst.ldstexclr_unpriv.STTXR_SR32_ldstexclr_unpriv" tworows="1">
        <box hibit="31" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="30" width="1" name="sz" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="29" width="7" settings="7">
          <c>0</c>
          <c>0</c>
          <c>1</c>
          <c>0</c>
          <c>0</c>
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="22" name="L" usename="1" settings="1" psbits="x">
          <c>0</c>
        </box>
        <box hibit="21" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="20" width="5" name="Rs" usename="1">
          <c colspan="5"/>
        </box>
        <box hibit="15" name="o0" usename="1" settings="1" psbits="x">
          <c>0</c>
        </box>
        <box hibit="14" width="5" name="Rt2" usename="1" settings="5" psbits="xxxxx">
          <c>(1)</c>
          <c>(1)</c>
          <c>(1)</c>
          <c>(1)</c>
          <c>(1)</c>
        </box>
        <box hibit="9" width="5" name="Rn" usename="1">
          <c colspan="5"/>
        </box>
        <box hibit="4" width="5" name="Rt" usename="1">
          <c colspan="5"/>
        </box>
      </regdiagram>
      <encoding name="STTXR_SR32_ldstexclr_unpriv" oneofinclass="2" oneof="2" label="32-bit" bitdiffs="sz == 0">
        <docvars>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A64"/>
          <docvar key="address-form" value="base-register"/>
          <docvar key="address-form-reg-type" value="base-register-32-reg"/>
          <docvar key="atomic-ops" value="STTXR-32-reg"/>
          <docvar key="reg-type" value="32-reg"/>
          <docvar key="mnemonic" value="STTXR"/>
        </docvars>
        <box hibit="30" width="1" name="sz">
          <c>0</c>
        </box>
        <asmtemplate><text>STTXR  </text><a hover="Is the 32-bit name of the general-purpose register into which the status result of the store exclusive is written, encoded in the &quot;Rs&quot; field. The value returned is:


0
: If the operation updates memory.

1
: If the operation fails to update memory." link="WsOrWZR__4">&lt;Ws&gt;</a><text>, </text><a hover="Is the 32-bit name of the general-purpose register to be transferred, encoded in the &quot;Rt&quot; field." link="WtOrWZR__4">&lt;Wt&gt;</a><text>, [</text><a hover="Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field." link="XnSP_option">&lt;Xn|SP&gt;</a><text>{, #0}]</text></asmtemplate>
      </encoding>
      <encoding name="STTXR_SR64_ldstexclr_unpriv" oneofinclass="2" oneof="2" label="64-bit" bitdiffs="sz == 1">
        <docvars>
          <docvar key="address-form" value="base-register"/>
          <docvar key="address-form-reg-type" value="base-register-64-reg"/>
          <docvar key="atomic-ops" value="STTXR-64-reg"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A64"/>
          <docvar key="reg-type" value="64-reg"/>
          <docvar key="mnemonic" value="STTXR"/>
        </docvars>
        <box hibit="30" width="1" name="sz">
          <c>1</c>
        </box>
        <asmtemplate><text>STTXR  </text><a hover="Is the 32-bit name of the general-purpose register into which the status result of the store exclusive is written, encoded in the &quot;Rs&quot; field. The value returned is:


0
: If the operation updates memory.

1
: If the operation fails to update memory." link="WsOrWZR__4">&lt;Ws&gt;</a><text>, </text><a hover="Is the 64-bit name of the general-purpose register to be transferred, encoded in the &quot;Rt&quot; field." link="XtOrXZR__11">&lt;Xt&gt;</a><text>, [</text><a hover="Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field." link="XnSP_option">&lt;Xn|SP&gt;</a><text>{, #0}]</text></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A64.ldst.ldstexclr_unpriv.STTXR_SR32_ldstexclr_unpriv" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">if !IsFeatureImplemented(FEAT_LSUI) then <a link="func_EndOfDecode_1" file="shared_pseudocode.xml">EndOfDecode</a>(<a link="enum_Decode_UNDEF" file="shared_pseudocode.xml">Decode_UNDEF</a>); end;
let s : integer{} = UInt(Rs);
let t : integer{} = UInt(Rt);
let n : integer{} = UInt(Rn);

let elsize : integer{} = 32 &lt;&lt; UInt(sz);
let acqrel : boolean = FALSE;
let tagchecked : boolean = n != 31;

var rt_unknown : boolean = FALSE;
var rn_unknown : boolean = FALSE;
if s == t then
    let c : <a link="type_Constraint" file="shared_pseudocode.xml">Constraint</a> = ConstrainUnpredictable(<a link="enum_Unpredictable_DATAOVERLAP" file="shared_pseudocode.xml">Unpredictable_DATAOVERLAP</a>);
    assert c IN {<a link="enum_Constraint_UNKNOWN" file="shared_pseudocode.xml">Constraint_UNKNOWN</a>, <a link="enum_Constraint_UNDEF" file="shared_pseudocode.xml">Constraint_UNDEF</a>, <a link="enum_Constraint_NOP" file="shared_pseudocode.xml">Constraint_NOP</a>};
    case c of
        when <a link="enum_Constraint_UNKNOWN" file="shared_pseudocode.xml">Constraint_UNKNOWN</a> =&gt;    rt_unknown = TRUE;    // store UNKNOWN value
        when <a link="enum_Constraint_UNDEF" file="shared_pseudocode.xml">Constraint_UNDEF</a> =&gt;      <a link="func_EndOfDecode_1" file="shared_pseudocode.xml">EndOfDecode</a>(<a link="enum_Decode_UNDEF" file="shared_pseudocode.xml">Decode_UNDEF</a>);
        when <a link="enum_Constraint_NOP" file="shared_pseudocode.xml">Constraint_NOP</a> =&gt;        <a link="func_EndOfDecode_1" file="shared_pseudocode.xml">EndOfDecode</a>(<a link="enum_Decode_NOP" file="shared_pseudocode.xml">Decode_NOP</a>);
    end;
end;
if s == n &amp;&amp; n != 31 then
    let c : <a link="type_Constraint" file="shared_pseudocode.xml">Constraint</a> = ConstrainUnpredictable(<a link="enum_Unpredictable_BASEOVERLAP" file="shared_pseudocode.xml">Unpredictable_BASEOVERLAP</a>);
    assert c IN {<a link="enum_Constraint_UNKNOWN" file="shared_pseudocode.xml">Constraint_UNKNOWN</a>, <a link="enum_Constraint_UNDEF" file="shared_pseudocode.xml">Constraint_UNDEF</a>, <a link="enum_Constraint_NOP" file="shared_pseudocode.xml">Constraint_NOP</a>};
    case c of
        when <a link="enum_Constraint_UNKNOWN" file="shared_pseudocode.xml">Constraint_UNKNOWN</a> =&gt;    rn_unknown = TRUE;    // address is UNKNOWN
        when <a link="enum_Constraint_UNDEF" file="shared_pseudocode.xml">Constraint_UNDEF</a> =&gt;      <a link="func_EndOfDecode_1" file="shared_pseudocode.xml">EndOfDecode</a>(<a link="enum_Decode_UNDEF" file="shared_pseudocode.xml">Decode_UNDEF</a>);
        when <a link="enum_Constraint_NOP" file="shared_pseudocode.xml">Constraint_NOP</a> =&gt;        <a link="func_EndOfDecode_1" file="shared_pseudocode.xml">EndOfDecode</a>(<a link="enum_Decode_NOP" file="shared_pseudocode.xml">Decode_NOP</a>);
    end;
end;</pstext></ps>
      </ps_section>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="STTXR_SR32_ldstexclr_unpriv, STTXR_SR64_ldstexclr_unpriv" symboldefcount="1">
      <symbol link="WsOrWZR__4">&lt;Ws&gt;</symbol>
      <account encodedin="Rs">
        <intro>
          <para>Is the 32-bit name of the general-purpose register into which the status result of the store exclusive is written, encoded in the &quot;Rs&quot; field. The value returned is:</para>
          <list type="param">
            <listitem>
              <param>0</param>
              <content>If the operation updates memory.</content>
            </listitem>
            <listitem>
              <param>1</param>
              <content>If the operation fails to update memory.</content>
            </listitem>
          </list>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STTXR_SR32_ldstexclr_unpriv" symboldefcount="1">
      <symbol link="WtOrWZR__4">&lt;Wt&gt;</symbol>
      <account encodedin="Rt">
        <intro>
          <para>Is the 32-bit name of the general-purpose register to be transferred, encoded in the &quot;Rt&quot; field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STTXR_SR32_ldstexclr_unpriv, STTXR_SR64_ldstexclr_unpriv" symboldefcount="1">
      <symbol link="XnSP_option">&lt;Xn|SP&gt;</symbol>
      <account encodedin="Rn">
        <intro>
          <para>Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STTXR_SR64_ldstexclr_unpriv" symboldefcount="1">
      <symbol link="XtOrXZR__11">&lt;Xt&gt;</symbol>
      <account encodedin="Rt">
        <intro>
          <para>Is the 64-bit name of the general-purpose register to be transferred, encoded in the &quot;Rt&quot; field.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="A64.ldst.ldstexclr_unpriv.STTXR_SR32_ldstexclr_unpriv" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">var address : bits(64);
var data : bits(elsize);

let dbytes : integer{} = elsize DIV 8;
let privileged : boolean = <a link="func_AArch64_IsUnprivAccessPriv_0" file="shared_pseudocode.xml">AArch64_IsUnprivAccessPriv</a>();
let accdesc : <a link="type_AccessDescriptor" file="shared_pseudocode.xml">AccessDescriptor</a> = <a link="func_CreateAccDescExLDST_5" file="shared_pseudocode.xml">CreateAccDescExLDST</a>(<a link="enum_MemOp_STORE" file="shared_pseudocode.xml">MemOp_STORE</a>, acqrel,
                                                     tagchecked, privileged, t);

if n == 31 then
    <a link="func_CheckSPAlignment_0" file="shared_pseudocode.xml">CheckSPAlignment</a>();
    address = <a link="accessor_SP_1" file="shared_pseudocode.xml">SP</a>{64}();
elsif rn_unknown then
    address = ARBITRARY : bits(64);
else
    address = <a link="accessor_X_2" file="shared_pseudocode.xml">X</a>{64}(n);
end;

if rt_unknown then
    data = ARBITRARY : bits(elsize);
else
    data = <a link="accessor_X_2" file="shared_pseudocode.xml">X</a>{elsize}(t);
end;
var status : bit = '1';
// Check whether the Exclusives monitors are set to include the
// physical memory locations corresponding to virtual address
// range [address, address+dbytes-1].
// If AArch64_ExclusiveMonitorsPass() returns FALSE and the memory address,
// if accessed, would generate a synchronous Data Abort exception, it is
// IMPLEMENTATION DEFINED whether the exception is generated.
// It is a limitation of this model that synchronous Data Aborts are never
// generated in this case, as Mem is not called.

// If FEAT_SPE is implemented, it is also IMPLEMENTATION DEFINED whether or not the
// physical address packet is output when permitted and when
// AArch64_ExclusiveMonitorPass() returns FALSE for a Store Exclusive instruction.
// This behavior is not reflected here due to the previously stated limitation.
if <a link="func_AArch64_ExclusiveMonitorsPass_3" file="shared_pseudocode.xml">AArch64_ExclusiveMonitorsPass</a>(address, dbytes, accdesc) then
    // This atomic write will be rejected if it does not refer
    // to the same physical locations after address translation.
    <a link="accessor_Mem_3" file="shared_pseudocode.xml">Mem</a>{elsize}(address, accdesc) = data;
    status = <a link="func_ExclusiveMonitorsStatus_0" file="shared_pseudocode.xml">ExclusiveMonitorsStatus</a>();
end;
<a link="accessor_X_2" file="shared_pseudocode.xml">X</a>{32}(s) = ZeroExtend{32}(status);</pstext></ps>
  </ps_section>
  <timestamp>2026-03-26 20:27:25</timestamp>
  <commit_id>2026-03_rel</commit_id>
</instructionsection>