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
9.6 KiB63 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>DCPS2 -- 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">DCPS2</h2>
4      <p class="aml">Debug Change PE State to EL2 allows the debugger to move the PE into EL2 from a lower Exception level.</p>
5      <p class="aml"><span class="asm-code">DCPS2</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 not implemented.</li>
9        <li>The PE is in Secure state and any of:<ul><li>Secure EL2 is not implemented.</li><li>Secure EL2 is implemented and Secure EL2 is disabled.</li></ul></li>
10      </ul>
11      <p class="aml">When the PE executes <span class="asm-code">DCPS2</span>:</p>
12      <ul>
13        <li>If EL2 is using AArch32, the PE enters Hyp mode and ELR_hyp, HSR, SPSR_hyp, DLR and DSPSR become <span class="arm-defined-word">UNKNOWN</span>.</li>
14        <li>If EL2 is using AArch64, the PE enters EL2 using AArch64, selects SP_EL2, and ELR_EL2, ESR_EL2, SPSR_EL2, DLR_EL0 and DSPSR_EL0 become <span class="arm-defined-word">UNKNOWN</span>.</li>
15      </ul>
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">1</td><td class="r">0</td></tr></tbody></table></div><div class="encoding"><h4 class="encoding">T1</h4><a id="DCPS2_T1"/><p class="asm-code">DCPS2</p></div><p class="pseudocode">if !<a href="shared_pseudocode.html#impl-shared.HaveEL.1" title="function: boolean HaveEL(bits(2) el)">HaveEL</a>(<a href="shared_pseudocode.html#EL2" title="constant bits(2) EL2 = '10'">EL2</a>) then UNDEFINED;</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>() || !<a href="shared_pseudocode.html#impl-shared.EL2Enabled.0" title="function: boolean EL2Enabled()">EL2Enabled</a>() then UNDEFINED;
22
23if <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
24    <a href="shared_pseudocode.html#AArch32.WriteMode.1" title="function: AArch32.WriteMode(bits(5) mode)">AArch32.WriteMode</a>(<a href="shared_pseudocode.html#M32_Hyp" title="constant bits(5) M32_Hyp = '11010'">M32_Hyp</a>);
25    PSTATE.E = HSCTLR.EE;
26
27    ELR_hyp = bits(32) UNKNOWN;
28    HSR = bits(32) UNKNOWN;
29    SPSR_hyp = bits(32) UNKNOWN;
30
31    DLR = bits(32) UNKNOWN;
32    DSPSR = bits(32) UNKNOWN;
33else                                        // Targeting EL2 using AArch64
34    <a href="shared_pseudocode.html#AArch64.MaybeZeroRegisterUppers.0" title="function: AArch64.MaybeZeroRegisterUppers()">AArch64.MaybeZeroRegisterUppers</a>();
35    MaybeZeroSVEUppers(EL2);
36    PSTATE.nRW = '0';
37    PSTATE.SP = '1';
38    PSTATE.EL = <a href="shared_pseudocode.html#EL2" title="constant bits(2) EL2 = '10'">EL2</a>;
39    if IsFeatureImplemented(FEAT_PAN) &amp;&amp; SCTLR_EL2.SPAN == '0' &amp;&amp; <a href="shared_pseudocode.html#impl-shared.ELIsInHost.1" title="function: boolean ELIsInHost(bits(2) el)">ELIsInHost</a>(<a href="shared_pseudocode.html#EL0" title="constant bits(2) EL0 = '00'">EL0</a>) then
40        PSTATE.PAN = '1';
41    if IsFeatureImplemented(FEAT_UAO) then PSTATE.UAO = '0';
42
43    ELR_EL2 = bits(64) UNKNOWN;
44    ESR_EL2 = bits(64) UNKNOWN;
45    SPSR_EL2 = bits(64) UNKNOWN;
46
47    DLR_EL0 = bits(64) UNKNOWN;
48    DSPSR_EL0 = bits(64) UNKNOWN;
49
50    // SCTLR_EL2.IESB might be ignored in Debug state.
51    if (IsFeatureImplemented(FEAT_IESB) &amp;&amp; SCTLR_EL2.IESB == '1' &amp;&amp;
52          !<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
53        <a href="shared_pseudocode.html#impl-shared.SynchronizeErrors.0" title="function: SynchronizeErrors()">SynchronizeErrors</a>();
54
55<a href="shared_pseudocode.html#impl-shared.UpdateEDSCRFields.0" title="function: UpdateEDSCRFields()">UpdateEDSCRFields</a>();                        // Update EDSCR PE state flags</p>
56    </div>
57  <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">
58      Internal version only: isa v01_31, pseudocode v2024-09_rel
59      ; Build timestamp: 2024-09-26T13:26
60    </p><p class="copyconf">
61      Copyright © 2010-2024 Arm Limited or its affiliates. All rights reserved.
62      This document is Non-Confidential.
63    </p></body></html>