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
10.6 KiB72 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>DCPS1 -- 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">DCPS1</h2>
4      <p class="aml">Debug Change PE State to EL1 allows the debugger to move the PE into EL1 from EL0 or to a specific mode at the current Exception level.</p>
5      <p class="aml"><span class="asm-code">DCPS1</span> is <span class="arm-defined-word">undefined</span> if any of:</p>
6      <ul>
7        <li>The PE is in Non-debug state.</li>
8        <li>EL2 is implemented, EL2 is implemented and enabled in the current Security state, and any of:<ul><li>EL2 is using AArch32 and HCR.TGE is set to 1.</li><li>EL2 is using AArch64 and HCR_EL2.TGE is set to 1.</li></ul></li>
9      </ul>
10      <p class="aml">When the PE executes <span class="asm-code">DCPS1</span> at EL0, EL1 or EL3:</p>
11      <ul>
12        <li>If EL3 or EL1 is using AArch32, the PE enters SVC mode and LR_svc, SPSR_svc, DLR, and DSPSR become <span class="arm-defined-word">UNKNOWN</span>. If <span class="asm-code">DCPS1</span> is executed in Monitor mode, SCR.NS is cleared to 0.</li>
13        <li>If EL1 is using AArch64, the PE enters EL1 using AArch64, selects SP_EL1, and ELR_EL1, ESR_EL1, SPSR_EL1, DLR_EL0 and DSPSR_EL0 become <span class="arm-defined-word">UNKNOWN</span>.</li>
14      </ul>
15      <p class="aml">When the PE executes <span class="asm-code">DCPS1</span> at EL2 the PE does not change mode, and ELR_hyp, HSR, SPSR_hyp, DLR and DSPSR become <span class="arm-defined-word">UNKNOWN</span>.</p>
16      <p class="aml">For more information on the operation of the DCPS&lt;n&gt; instructions, see <a class="armarm-xref" title="Reference to Armv8 ARM section" data-linkend="dcps">DCPS</a>.</p>
17    
18    <h3 class="classheading"><a id="iclass_t1"/>T1</h3><p class="desc"/><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>1</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td><td class="r">0</td><td class="l">1</td><td>1</td><td>1</td><td class="r">1</td><td class="l">1</td><td>0</td><td>0</td><td class="r">0</td><td class="l">0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td class="r">0</td><td class="l">0</td><td class="r">1</td></tr></tbody></table></div><div class="encoding"><h4 class="encoding">T1</h4><a id="DCPS1_T1"/><p class="asm-code">DCPS1</p></div><p class="pseudocode">// No additional decoding required.</p>
19  <div class="encoding-notes"/>
20    <div class="ps"><a id="execute"/><h3 class="pseudocode">Operation</h3>
21      <p class="pseudocode">if !<a href="shared_pseudocode.html#impl-shared.Halted.0" title="function: boolean Halted()">Halted</a>() then UNDEFINED;
22
23if <a href="shared_pseudocode.html#impl-shared.EL2Enabled.0" title="function: boolean EL2Enabled()">EL2Enabled</a>() &amp;&amp; PSTATE.EL == <a href="shared_pseudocode.html#EL0" title="constant bits(2) EL0 = '00'">EL0</a> then
24    constant tge = if <a href="shared_pseudocode.html#impl-shared.ELUsingAArch32.1" title="function: boolean ELUsingAArch32(bits(2) el)">ELUsingAArch32</a>(<a href="shared_pseudocode.html#EL2" title="constant bits(2) EL2 = '10'">EL2</a>) then HCR.TGE else HCR_EL2.TGE;
25    if tge == '1' then UNDEFINED;
26
27if PSTATE.EL != <a href="shared_pseudocode.html#EL0" title="constant bits(2) EL0 = '00'">EL0</a> || <a href="shared_pseudocode.html#impl-shared.ELUsingAArch32.1" title="function: boolean ELUsingAArch32(bits(2) el)">ELUsingAArch32</a>(<a href="shared_pseudocode.html#EL1" title="constant bits(2) EL1 = '01'">EL1</a>) then
28    if PSTATE.M == <a href="shared_pseudocode.html#M32_Monitor" title="constant bits(5) M32_Monitor = '10110'">M32_Monitor</a> then SCR.NS = '0';
29    if PSTATE.EL != <a href="shared_pseudocode.html#EL2" title="constant bits(2) EL2 = '10'">EL2</a> then
30        <a href="shared_pseudocode.html#AArch32.WriteMode.1" title="function: AArch32.WriteMode(bits(5) mode)">AArch32.WriteMode</a>(<a href="shared_pseudocode.html#M32_Svc" title="constant bits(5) M32_Svc = '10011'">M32_Svc</a>);
31        PSTATE.E = SCTLR.EE;
32        if IsFeatureImplemented(FEAT_PAN) &amp;&amp; SCTLR.SPAN == '0' then PSTATE.PAN = '1';
33        LR_svc = bits(32) UNKNOWN;
34        SPSR_svc = bits(32) UNKNOWN;
35    else
36        PSTATE.E = HSCTLR.EE;
37        ELR_hyp = bits(32) UNKNOWN;
38        HSR = bits(32) UNKNOWN;
39        SPSR_hyp = bits(32) UNKNOWN;
40
41    DLR = bits(32) UNKNOWN;
42    DSPSR = bits(32) UNKNOWN;
43else                                        // Targeting EL1 using AArch64
44    <a href="shared_pseudocode.html#AArch64.MaybeZeroRegisterUppers.0" title="function: AArch64.MaybeZeroRegisterUppers()">AArch64.MaybeZeroRegisterUppers</a>();
45    MaybeZeroSVEUppers(EL1);
46    PSTATE.nRW = '0';
47    PSTATE.SP = '1';
48    PSTATE.EL = <a href="shared_pseudocode.html#EL1" title="constant bits(2) EL1 = '01'">EL1</a>;
49    if IsFeatureImplemented(FEAT_PAN) &amp;&amp; SCTLR_EL1.SPAN == '0' then PSTATE.PAN = '1';
50    if IsFeatureImplemented(FEAT_UAO) then PSTATE.UAO = '0';
51
52    ELR_EL1 = bits(64) UNKNOWN;
53    ESR_EL1 = bits(64) UNKNOWN;
54    SPSR_EL1 = bits(64) UNKNOWN;
55
56    DLR_EL0 = bits(64) UNKNOWN;
57    DSPSR_EL0 = bits(64) UNKNOWN;
58
59    // SCTLR_EL1.IESB might be ignored in Debug state.
60    if (IsFeatureImplemented(FEAT_IESB) &amp;&amp; SCTLR_EL1.IESB == '1' &amp;&amp;
61          !<a href="shared_pseudocode.html#impl-shared.ConstrainUnpredictableBool.1" title="function: boolean ConstrainUnpredictableBool(Unpredictable which)">ConstrainUnpredictableBool</a>(<a href="shared_pseudocode.html#Unpredictable_IESBinDebug" title="enumeration Unpredictable {  Unpredictable_VMSR,  Unpredictable_WBOVERLAPLD,  Unpredictable_WBOVERLAPST,  Unpredictable_LDPOVERLAP,  Unpredictable_BASEOVERLAP,  Unpredictable_DATAOVERLAP,  Unpredictable_DEVPAGE2,  Unpredictable_INSTRDEVICE,  Unpredictable_RESCPACR,  Unpredictable_RESMAIR,  Unpredictable_S1CTAGGED,  Unpredictable_S2RESMEMATTR,  Unpredictable_RESTEXCB,  Unpredictable_RESPRRR,  Unpredictable_RESDACR,  Unpredictable_RESVTCRS,  Unpredictable_RESTnSZ,  Unpredictable_RESTCF,  Unpredictable_DEVICETAGSTORE,  Unpredictable_OORTnSZ,   Unpredictable_LARGEIPA,  Unpredictable_ESRCONDPASS,  Unpredictable_ILZEROIT,  Unpredictable_ILZEROT,  Unpredictable_BPVECTORCATCHPRI,  Unpredictable_VCMATCHHALF,   Unpredictable_VCMATCHDAPA,  Unpredictable_WPMASKANDBAS,  Unpredictable_WPBASCONTIGUOUS,  Unpredictable_RESWPMASK,  Unpredictable_WPMASKEDBITS,  Unpredictable_RESBPWPCTRL,  Unpredictable_BPNOTIMPL,  Unpredictable_RESBPTYPE,  Unpredictable_RESMDSELR,  Unpredictable_BPNOTCTXCMP,  Unpredictable_BPMATCHHALF,  Unpredictable_BPMISMATCHHALF,   Unpredictable_BPLINKINGDISABLED,  Unpredictable_RESBPMASK,   Unpredictable_BPMASK,  Unpredictable_BPMASKEDBITS,   Unpredictable_BPLINKEDADDRMATCH,  Unpredictable_RESTARTALIGNPC,  Unpredictable_RESTARTZEROUPPERPC,  Unpredictable_ZEROUPPER,   Unpredictable_ERETZEROUPPERPC,   Unpredictable_A32FORCEALIGNPC,  Unpredictable_SMD,  Unpredictable_NONFAULT,  Unpredictable_SVEZEROUPPER,  Unpredictable_SVELDNFDATA,  Unpredictable_SVELDNFZERO,  Unpredictable_CHECKSPNONEACTIVE,  Unpredictable_SMEZEROUPPER,   Unpredictable_16BYTEROUNDEDUPACCESS,   Unpredictable_16BYTEROUNDEDDOWNACCESS,  Unpredictable_NVNV1,  Unpredictable_Shareability,  Unpredictable_AFUPDATE,  Unpredictable_DBUPDATE,  Unpredictable_IESBinDebug,  Unpredictable_BADPMSFCR,  Unpredictable_ZEROBTYPE,  Unpredictable_EL2TIMESTAMP, Unpredictable_EL1TIMESTAMP,  Unpredictable_RESERVEDNSxB,  Unpredictable_WFxTDEBUG,  Unpredictable_LS64UNSUPPORTED,    Unpredictable_MISALIGNEDATOMIC,  Unpredictable_LSE128OVERLAP,  Unpredictable_CLEARERRITEZERO,   Unpredictable_ALUEXCEPTIONRETURN,  Unpredictable_IGNORETRAPINDEBUG,  Unpredictable_DBGxVR_RESS,  Unpredictable_PMUEVENTCOUNTER,  Unpredictable_PMSCR_PCT,   Unpredictable_RES_HPMN,  Unpredictable_RES_EPMN,  Unpredictable_BRBFILTRATE,  Unpredictable_PMUSNAPSHOTEVENT,  Unpredictable_RESEPMSSAD,  Unpredictable_RESPMSSE,  Unpredictable_RESPMEE,  Unpredictable_RESPMSEE,  Unpredictable_RESTRFEE,  Unpredictable_MOPSOVERLAP,   Unpredictable_MOPS_R31,  Unpredictable_STOREONLYTAGCHECKEDCAS,  Unpredictable_RES_ETBAD,  Unpredictable_RES_PMU_VS,   Unpredictable_CPACHECK,  Unpredictable_RESTC,    Unpredictable_NODTRTAGCHK,    Unpredictable_Atomic_SYNC_ABORT, Unpredictable_Atomic_SERROR, Unpredictable_Atomic_MMU_IMPDEF_FAULT, Unpredictable_Atomic_NOP,  Unpredictable_MRC_APSR_TARGET }">Unpredictable_IESBinDebug</a>)) then
62        <a href="shared_pseudocode.html#impl-shared.SynchronizeErrors.0" title="function: SynchronizeErrors()">SynchronizeErrors</a>();
63
64<a href="shared_pseudocode.html#impl-shared.UpdateEDSCRFields.0" title="function: UpdateEDSCRFields()">UpdateEDSCRFields</a>();                        // Update EDSCR PE state flags</p>
65    </div>
66  <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">
67      Internal version only: isa v01_31, pseudocode v2024-09_rel
68      ; Build timestamp: 2024-09-26T13:26
69    </p><p class="copyconf">
70      Copyright © 2010-2024 Arm Limited or its affiliates. All rights reserved.
71      This document is Non-Confidential.
72    </p></body></html>