collab/polyglot-riscv-arm

what if the same machine code was valid riscv and arm asm

git clone https://git.julia.blue/collab/polyglot-riscv-arm

Jonathan Dönszelmannwebsite start885cc4e

main
17.9 KiB105 linesraw
1<?xml version="1.0" encoding="utf-8"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="insn.css"/><meta name="generator" content="iform.xsl"/><title>DMB -- AArch32</title></head><body><table style="margin: 0 auto;"><tr><td><div class="topbar"><a href="index.html">Base Instructions</a></div></td><td><div class="topbar"><a href="fpsimdindex.html">SIMD&amp;FP Instructions</a></div></td><td><div class="topbar"><a href="a32_encindex.html">A32 Instructions by Encoding</a></div></td><td><div class="topbar"><a href="t32_encindex.html">T32 Instructions by Encoding</a></div></td><td><div class="topbar"><a href="shared_pseudocode.html">Shared Pseudocode</a></div></td><td><div class="topbar"><a href="notice.html">Proprietary Notice</a></div></td></tr></table><hr/><h2 class="instruction-section">DMB</h2>
4      <p class="aml">Data Memory Barrier is a memory barrier that ensures the ordering of observations of memory accesses, see <a class="armarm-xref" title="Reference to Armv8 ARM section" data-linkend="AA32CHDCIFHJ">Data Memory Barrier (DMB)</a>.</p>
5    
6    <p class="desc">
7      It has encodings from the following instruction sets:
8       A32 (
9      <a href="#iclass_a1">A1</a>
10      )
11       and 
12       T32 (
13      <a href="#iclass_t1">T1</a>
14      )
15      .
16    </p>
17    <h3 class="classheading"><a id="iclass_a1"/>A1</h3><div class="regdiagram-32"><table class="regdiagram"><thead><tr><td>31</td><td>30</td><td>29</td><td>28</td><td>27</td><td>26</td><td>25</td><td>24</td><td>23</td><td>22</td><td>21</td><td>20</td><td>19</td><td>18</td><td>17</td><td>16</td><td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td></tr></thead><tbody><tr class="firstrow"><td class="l">1</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td><td class="r">1</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(0)</td><td class="lr">(0)</td><td class="lr">(0)</td><td class="lr">(0)</td><td class="l">0</td><td>1</td><td>0</td><td class="r">1</td><td colspan="4" class="lr">option</td></tr></tbody></table></div><div class="encoding"><h4 class="encoding">A1</h4><a id="DMB_A1"/><p class="asm-code">DMB{<a href="#sa_c_1" title="See {xref{ARMARM_Babbefhf}{Standard assembler syntax fields}}">&lt;c&gt;</a>}{<a href="#sa_q" title="See {xref{ARMARM_Babbefhf}{Standard assembler syntax fields}}">&lt;q&gt;</a>} {<a href="#sa_option" title="Specifies an optional limitation on the barrier operation">&lt;option&gt;</a>}</p></div><p class="pseudocode">// No additional decoding required</p>
18    <h3 class="classheading"><a id="iclass_t1"/>T1</h3><div class="regdiagram-16x2"><table class="regdiagram"><thead><tr><td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td><td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td></tr></thead><tbody><tr class="firstrow"><td class="l">1</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td class="r">1</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="l">1</td><td class="r">0</td><td class="lr">(0)</td><td class="lr">0</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="lr">(1)</td><td class="l">0</td><td>1</td><td>0</td><td class="r">1</td><td colspan="4" class="lr">option</td></tr></tbody></table></div><div class="encoding"><h4 class="encoding">T1</h4><a id="DMB_T1"/><p class="asm-code">DMB{<a href="#sa_c" title="See {xref{ARMARM_Babbefhf}{Standard assembler syntax fields}}">&lt;c&gt;</a>}{<a href="#sa_q" title="See {xref{ARMARM_Babbefhf}{Standard assembler syntax fields}}">&lt;q&gt;</a>} {<a href="#sa_option" title="Specifies an optional limitation on the barrier operation">&lt;option&gt;</a>}</p></div><p class="pseudocode">// No additional decoding required</p>
19  <div class="encoding-notes">
20      <p class="aml">For more information about the <span class="arm-defined-word">constrained unpredictable</span> behavior, see <a class="armarm-xref" title="Reference to Armv8 ARM section" data-linkend="CJAEGDJC">Architectural Constraints on UNPREDICTABLE behaviors</a>.</p>
21    </div><h3 class="explanations">Assembler Symbols</h3><div class="explanations"><table><col class="asyn-l"/><col class="asyn-r"/><tr><td>&lt;c&gt;</td><td><a id="sa_c_1"/>
22        
23          
24          
25        
26        
27          <p class="aml">For encoding A1: see <a class="armarm-xref" title="Reference to Armv8 ARM section" data-linkend="Babbefhf">Standard assembler syntax fields</a>. Must be AL or omitted.</p>
28        
29      </td></tr><tr><td/><td><a id="sa_c"/>
30        
31          
32          
33        
34        
35          <p class="aml">For encoding T1: see <a class="armarm-xref" title="Reference to Armv8 ARM section" data-linkend="Babbefhf">Standard assembler syntax fields</a>.</p>
36        
37      </td></tr></table><table><col class="asyn-l"/><col class="asyn-r"/><tr><td>&lt;q&gt;</td><td><a id="sa_q"/>
38        
39          <p class="aml">See <a class="armarm-xref" title="Reference to Armv8 ARM section" data-linkend="Babbefhf">Standard assembler syntax fields</a>.</p>
40        
41      </td></tr></table><table><col class="asyn-l"/><col class="asyn-r"/><tr><td>&lt;option&gt;</td><td><a id="sa_option"/>
42        
43          <p class="aml">Specifies an optional limitation on the barrier operation. Values are:</p>
44          <dl>
45            <dt>SY</dt><dd>Full system is the required shareability domain, reads and writes are the required access types, both before and after the barrier instruction. Can be omitted. This option is referred to as the full system barrier. Encoded as option = 0b1111.</dd>
46            <dt>ST</dt><dd>Full system is the required shareability domain, writes are the required access type, both before and after the barrier instruction. SYST is a synonym for ST. Encoded as option = 0b1110.</dd>
47            <dt>LD</dt><dd>Full system is the required shareability domain, reads are the required access type before the barrier instruction, and reads and writes are the required access types after the barrier instruction. Encoded as option = 0b1101.</dd>
48            <dt>ISH</dt><dd>Inner Shareable is the required shareability domain, reads and writes are the required access types, both before and after the barrier instruction. Encoded as option = 0b1011.</dd>
49            <dt>ISHST</dt><dd>Inner Shareable is the required shareability domain, writes are the required access type, both before and after the barrier instruction. Encoded as option = 0b1010.</dd>
50            <dt>ISHLD</dt><dd>Inner Shareable is the required shareability domain, reads are the required access type before the barrier instruction, and reads and writes are the required access types after the barrier instruction. Encoded as option = 0b1001.</dd>
51            <dt>NSH</dt><dd>Non-shareable is the required shareability domain, reads and writes are the required access, both before and after the barrier instruction. Encoded as option = 0b0111.</dd>
52            <dt>NSHST</dt><dd>Non-shareable is the required shareability domain, writes are the required access type both before and after the barrier instruction. Encoded as option = 0b0110.</dd>
53            <dt>NSHLD</dt><dd>Non-shareable is the required shareability domain, reads are the required access type before the barrier instruction, and reads and writes are the required access types after the barrier instruction. Encoded as option = 0b0101.</dd>
54            <dt>OSH</dt><dd>Outer Shareable is the required shareability domain, reads and writes are the required access types, both before and after the barrier instruction. Encoded as option = 0b0011.</dd>
55            <dt>OSHST</dt><dd>Outer Shareable is the required shareability domain, writes are the required access type, both before and after the barrier instruction. Encoded as option = 0b0010.</dd>
56            <dt>OSHLD</dt><dd>Outer Shareable is the required shareability domain, reads are the required access type before the barrier instruction, and reads and writes are the required access types after the barrier instruction. Encoded as option = 0b0001.</dd>
57          </dl>
58          <p class="aml">For more information on whether an access is before or after a barrier instruction, see <a class="armarm-xref" title="Reference to Armv8 ARM section" data-linkend="AA32CHDCIFHJ">Data Memory Barrier (DMB)</a>. All other encodings of option are reserved. All unsupported and reserved options must execute as a full system DMB operation, but software must not rely on this behavior.</p>
59          <div class="note"><hr class="note"/><h4>Note</h4>
60            <p class="aml">The instruction supports the following alternative &lt;option&gt; values, but Arm recommends that software does not use these alternative values:</p>
61            <ul>
62              <li>SH as an alias for ISH.</li>
63              <li>SHST as an alias for ISHST.</li>
64              <li>UN as an alias for NSH.</li>
65              <li>UNST as an alias for NSHST.</li>
66            </ul>
67          <hr class="note"/></div>
68        
69      </td></tr></table></div><div class="syntax-notes"/>
70    <div class="ps"><a id="execute"/><h3 class="pseudocode">Operation</h3>
71      <p class="pseudocode">if <a href="shared_pseudocode.html#impl-aarch32.ConditionPassed.0" title="function: boolean ConditionPassed()">ConditionPassed</a>() then
72    EncodingSpecificOperations();
73    <a href="shared_pseudocode.html#MBReqDomain" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain</a> domain;
74    <a href="shared_pseudocode.html#MBReqTypes" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes</a> types;
75    case option of
76        when '0001'  domain = <a href="shared_pseudocode.html#MBReqDomain_OuterShareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_OuterShareable</a>;  types = <a href="shared_pseudocode.html#MBReqTypes_Reads" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_Reads</a>;
77        when '0010'  domain = <a href="shared_pseudocode.html#MBReqDomain_OuterShareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_OuterShareable</a>;  types = <a href="shared_pseudocode.html#MBReqTypes_Writes" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_Writes</a>;
78        when '0011'  domain = <a href="shared_pseudocode.html#MBReqDomain_OuterShareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_OuterShareable</a>;  types = <a href="shared_pseudocode.html#MBReqTypes_All" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_All</a>;
79        when '0101'  domain = <a href="shared_pseudocode.html#MBReqDomain_Nonshareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_Nonshareable</a>;    types = <a href="shared_pseudocode.html#MBReqTypes_Reads" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_Reads</a>;
80        when '0110'  domain = <a href="shared_pseudocode.html#MBReqDomain_Nonshareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_Nonshareable</a>;    types = <a href="shared_pseudocode.html#MBReqTypes_Writes" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_Writes</a>;
81        when '0111'  domain = <a href="shared_pseudocode.html#MBReqDomain_Nonshareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_Nonshareable</a>;    types = <a href="shared_pseudocode.html#MBReqTypes_All" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_All</a>;
82        when '1001'  domain = <a href="shared_pseudocode.html#MBReqDomain_InnerShareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_InnerShareable</a>;  types = <a href="shared_pseudocode.html#MBReqTypes_Reads" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_Reads</a>;
83        when '1010'  domain = <a href="shared_pseudocode.html#MBReqDomain_InnerShareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_InnerShareable</a>;  types = <a href="shared_pseudocode.html#MBReqTypes_Writes" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_Writes</a>;
84        when '1011'  domain = <a href="shared_pseudocode.html#MBReqDomain_InnerShareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_InnerShareable</a>;  types = <a href="shared_pseudocode.html#MBReqTypes_All" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_All</a>;
85        when '1101'  domain = <a href="shared_pseudocode.html#MBReqDomain_FullSystem" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_FullSystem</a>;      types = <a href="shared_pseudocode.html#MBReqTypes_Reads" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_Reads</a>;
86        when '1110'  domain = <a href="shared_pseudocode.html#MBReqDomain_FullSystem" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_FullSystem</a>;      types = <a href="shared_pseudocode.html#MBReqTypes_Writes" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_Writes</a>;
87        otherwise    domain = <a href="shared_pseudocode.html#MBReqDomain_FullSystem" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_FullSystem</a>;      types = <a href="shared_pseudocode.html#MBReqTypes_All" title="enumeration MBReqTypes     {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All}">MBReqTypes_All</a>;
88
89    if PSTATE.EL IN {<a href="shared_pseudocode.html#EL0" title="constant bits(2) EL0 = '00'">EL0</a>, <a href="shared_pseudocode.html#EL1" title="constant bits(2) EL1 = '01'">EL1</a>} &amp;&amp; <a href="shared_pseudocode.html#impl-shared.EL2Enabled.0" title="function: boolean EL2Enabled()">EL2Enabled</a>() then
90        if HCR.BSU == '11' then
91            domain = <a href="shared_pseudocode.html#MBReqDomain_FullSystem" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_FullSystem</a>;
92        if HCR.BSU == '10' &amp;&amp; domain != <a href="shared_pseudocode.html#MBReqDomain_FullSystem" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_FullSystem</a> then
93            domain = <a href="shared_pseudocode.html#MBReqDomain_OuterShareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_OuterShareable</a>;
94        if HCR.BSU == '01' &amp;&amp; domain == <a href="shared_pseudocode.html#MBReqDomain_Nonshareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_Nonshareable</a> then
95            domain = <a href="shared_pseudocode.html#MBReqDomain_InnerShareable" title="enumeration MBReqDomain    {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable, MBReqDomain_OuterShareable, MBReqDomain_FullSystem}">MBReqDomain_InnerShareable</a>;
96
97    <a href="shared_pseudocode.html#impl-shared.DataMemoryBarrier.2" title="function: DataMemoryBarrier(MBReqDomain domain, MBReqTypes types)">DataMemoryBarrier</a>(domain, types);</p>
98    </div>
99  <hr/><table style="margin: 0 auto;"><tr><td><div class="topbar"><a href="index.html">Base Instructions</a></div></td><td><div class="topbar"><a href="fpsimdindex.html">SIMD&amp;FP Instructions</a></div></td><td><div class="topbar"><a href="a32_encindex.html">A32 Instructions by Encoding</a></div></td><td><div class="topbar"><a href="t32_encindex.html">T32 Instructions by Encoding</a></div></td><td><div class="topbar"><a href="shared_pseudocode.html">Shared Pseudocode</a></div></td><td><div class="topbar"><a href="notice.html">Proprietary Notice</a></div></td></tr></table><p class="versions">
100      Internal version only: isa v01_31, pseudocode v2024-09_rel
101      ; Build timestamp: 2024-09-26T13:26
102    </p><p class="copyconf">
103      Copyright © 2010-2024 Arm Limited or its affiliates. All rights reserved.
104      This document is Non-Confidential.
105    </p></body></html>