From b2011c9aaa3bccfa7af028cba63e81582e662504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A4ll=C3=A9n?= Date: Fri, 19 Jan 2024 22:28:33 +0100 Subject: [PATCH] Feature: implemented privileged instructions in the RiscV disassembler. --- src/Arch/RiscV/InstructionSet.cs | 47 ++++- src/Arch/RiscV/Mnemonic.cs | 22 ++ src/Arch/RiscV/RiscVDisassembler.cs | 6 + .../Arch/RiscV/RiscVDisassemblerTests.cs | 192 ++++++++++++++--- .../Arch/RiscV/RiscVRewriterTests.cs | 199 ++++++++++++++++-- subjects/regression.log | 13 +- 6 files changed, 422 insertions(+), 57 deletions(-) diff --git a/src/Arch/RiscV/InstructionSet.cs b/src/Arch/RiscV/InstructionSet.cs index 44aebfbf96..08b70051f1 100644 --- a/src/Arch/RiscV/InstructionSet.cs +++ b/src/Arch/RiscV/InstructionSet.cs @@ -501,19 +501,50 @@ public Decoder[] CreateRootDecoders() Nyi("amo - 111")); var system = Mask(12, 3, " system", - Sparse(20, 12, "system", // 0b11100 + Sparse(25, 7, " system 000", Nyi("system 000"), - (0, Instr(Mnemonic.ecall, InstrClass.Transfer | InstrClass.Call)), - (1, Instr(Mnemonic.ebreak, InstrClass.Terminates)), - (0b0000000_00010, Instr(Mnemonic.uret, InstrClass.Transfer | InstrClass.Return)), - (0b0001000_00010, Instr(Mnemonic.sret, InstrClass.Transfer | InstrClass.Return)), - (0b0011000_00010, Instr(Mnemonic.mret, InstrClass.Transfer | InstrClass.Return)), - (0b0001000_00101, Instr(Mnemonic.wfi, InstrClass.Linear))), + (0x00, Sparse(20, 5, " system 0x00", Nyi("system 0x00"), + (0, Instr(Mnemonic.ecall, InstrClass.Transfer | InstrClass.Call)), + (1, Instr(Mnemonic.ebreak, InstrClass.Terminates)), + (2, Instr(Mnemonic.uret, InstrClass.Transfer | InstrClass.Return)))), + (0x08, Sparse(20, 5, " system 0x08", Nyi("system 0x08"), + (2, Instr(Mnemonic.sret, InstrClass.Privileged | InstrClass.Transfer | InstrClass.Return)), + (5, Instr(Mnemonic.wfi, InstrClass.Privileged | InstrClass.Linear)))), + (0x09, Instr(Mnemonic.sfence_vma, InstrClass.Privileged | InstrClass.Linear, R2, Mem(PrimitiveType.Word32, 15))), + (0x0B, Instr(Mnemonic.sfence_inval, InstrClass.Privileged | InstrClass.Linear, Mem(PrimitiveType.Word32, 15))), + (0x0C, Sparse(20, 5, " system 0x0C", Nyi("system 0x0C"), + (0, Instr(Mnemonic.sfence_w_inval, InstrClass.Privileged | InstrClass.Linear)), + (1, Instr(Mnemonic.sfence_inval_ir, InstrClass.Privileged | InstrClass.Linear)))), + (0x11, Instr(Mnemonic.hfence_vvma, InstrClass.Privileged | InstrClass.Linear, R2, Mem(PrimitiveType.Word32, 15))), + (0x13, Instr(Mnemonic.hinval_vvma, InstrClass.Privileged | InstrClass.Linear, R2, Mem(PrimitiveType.Word32, 15))), + (0x31, Instr(Mnemonic.hfence_gvma, InstrClass.Privileged | InstrClass.Linear, R2, Mem(PrimitiveType.Word32, 15))), + (0x33, Instr(Mnemonic.hinval_gvma, InstrClass.Privileged | InstrClass.Linear, R2, Mem(PrimitiveType.Word32, 15))), + + (0x18, Sparse(20, 5, " system 11000", Nyi("system 11000"), + (2, Instr(Mnemonic.mret, InstrClass.Privileged | InstrClass.Transfer | InstrClass.Return))))), Instr(Mnemonic.csrrw, d, Csr20, r1), Instr(Mnemonic.csrrs, d, Csr20, r1), Instr(Mnemonic.csrrc, d, Csr20, r1), - invalid, + Sparse(25, 7, " system 100", + Nyi("system 100"), + (0x30, Sparse(20, 5, " system 0x30", Nyi("system 0x30"), + (0, Instr(Mnemonic.hlv_b, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.Int8, 15))), + (1, Instr(Mnemonic.hlv_bu, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.UInt8, 15))))), + (0x32, Sparse(20, 5, " system 0x32", Nyi("system 0x32"), + (0, Instr(Mnemonic.hlv_h, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.Int16, 15))), + (1, Instr(Mnemonic.hlv_hu, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.UInt16, 15))), + (3, Instr(Mnemonic.hlvx_hu, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.UInt16, 15))))), + (0x34, Sparse(20, 5, " system 0x34", Nyi("system 0x34"), + (0, Instr(Mnemonic.hlv_w, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.Int32, 15))), + (1, Instr(Mnemonic.hlv_wu, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.UInt32, 15))), + (3, Instr(Mnemonic.hlvx_wu, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.UInt32, 15))))), + (0x36, Sparse(20, 5, " system 0x36", Nyi("system 0x36"), + (0, Instr(Mnemonic.hlv_d, InstrClass.Privileged | InstrClass.Linear, Rd, Mem(PrimitiveType.UInt64, 15))))), + (0x31, Instr(Mnemonic.hsv_b, InstrClass.Privileged | InstrClass.Linear, Mem(PrimitiveType.Byte, 15), R2)), + (0x33, Instr(Mnemonic.hsv_h, InstrClass.Privileged | InstrClass.Linear, Mem(PrimitiveType.Word16, 15), R2)), + (0x35, Instr(Mnemonic.hsv_w, InstrClass.Privileged | InstrClass.Linear, Mem(PrimitiveType.Word32, 15), R2)), + (0x37, Instr(Mnemonic.hsv_d, InstrClass.Privileged | InstrClass.Linear, Mem(PrimitiveType.Word64, 15), R2))), Instr(Mnemonic.csrrwi, d, Csr20, Imm(15, 5)), Instr(Mnemonic.csrrsi, d, Csr20, Imm(15, 5)), Instr(Mnemonic.csrrci, d, Csr20, Imm(15, 5))); diff --git a/src/Arch/RiscV/Mnemonic.cs b/src/Arch/RiscV/Mnemonic.cs index 060c2a2ad0..adbefccbd9 100644 --- a/src/Arch/RiscV/Mnemonic.cs +++ b/src/Arch/RiscV/Mnemonic.cs @@ -287,5 +287,27 @@ public enum Mnemonic wfi, xor, xori, + sfence_vma, + sfence_inval, + sfence_w_inval, + sfence_inval_ir, + hfence_vvma, + hinval_vvma, + hfence_gvma, + hinval_gvma, + + hlv_b, + hlv_bu, + hlv_h, + hlv_hu, + hlvx_hu, + hlv_w, + hlvx_wu, + hsv_b, + hsv_h, + hsv_w, + hsv_d, + hlv_wu, + hlv_d, } } \ No newline at end of file diff --git a/src/Arch/RiscV/RiscVDisassembler.cs b/src/Arch/RiscV/RiscVDisassembler.cs index 36e6dc5038..ffd086841c 100644 --- a/src/Arch/RiscV/RiscVDisassembler.cs +++ b/src/Arch/RiscV/RiscVDisassembler.cs @@ -220,6 +220,9 @@ public override RiscVInstruction CreateInvalidInstruction() }; } + /// + /// Register encoded at bit position 15 + /// private static bool r1(uint wInstr, RiscVDisassembler dasm) { var op = dasm.GetRegister(wInstr, 15); @@ -227,6 +230,9 @@ private static bool r1(uint wInstr, RiscVDisassembler dasm) return true; } + /// + /// Register encoded at bit position 20 + /// private static bool r2(uint wInstr, RiscVDisassembler dasm) { var op = dasm.GetRegister(wInstr, 20); diff --git a/src/UnitTests/Arch/RiscV/RiscVDisassemblerTests.cs b/src/UnitTests/Arch/RiscV/RiscVDisassemblerTests.cs index feaa154998..ee75a182ad 100644 --- a/src/UnitTests/Arch/RiscV/RiscVDisassemblerTests.cs +++ b/src/UnitTests/Arch/RiscV/RiscVDisassemblerTests.cs @@ -24,6 +24,8 @@ using Reko.Core.Machine; using System.Collections.Generic; using System.ComponentModel.Design; +using System.Reflection.PortableExecutable; +using System.Security.Cryptography; namespace Reko.UnitTests.Arch.RiscV { @@ -35,7 +37,6 @@ public class RiscVDisassemblerTests : DisassemblerTestBase public RiscVDisassemblerTests() { - Reko.Core.Machine.Decoder.trace.Level = System.Diagnostics.TraceLevel.Verbose; } [SetUp] @@ -43,7 +44,7 @@ public void Setup() { this.arch = new RiscVArchitecture( new ServiceContainer(), - "riscV", + "riscV", new Dictionary { { ProcessorOption.WordSize, "64" }, @@ -760,35 +761,160 @@ public void RiscV_dasm_sllw() [Test] public void RiscV_dasm_regressions1() { - -AssertCode("fence.i", "0f100000"); // invalid -AssertCode("csrrw\ts2,00000315,t0", "73995231"); // invalid -AssertCode("csrrs\ta1,sstatus,a5", "f3a50710"); // csrrs a1,sstatus,a5 -AssertCode("csrrc\ttp,000005F0,s0", "7332045f"); // invalid -AssertCode("csrrc\ttp,000005F0,zero", "7332005f"); // invalid -AssertCode("csrrsi\ts2,000006E6,0000001E", "73696f6e"); // invalid -AssertCode("csrrci\ts0,000006A5,0000001A", "73745d6a"); // invalid -AssertCode("mul\ta0,s5,s7", "33857a03"); // add a0,s5,s7 -AssertCode("mulh\tt5,a7,s1", "339f9802"); // sll t5,a7,s1 -AssertCode("mulhsu\tt3,sp,a6", "332e0103"); // slt t3,sp,a6 -AssertCode("mulhu\tt3,sp,a6", "333e0103"); // sltu t3,sp,a6 -AssertCode("mulhsu\tt3,sp,a6", "332e0103"); // slt t3,sp,a6 -AssertCode("divu\tt4,t3,t2", "b35e7e02"); // srl t4,t3,t2 -AssertCode("rem\ta4,a1,a2", "33e7c502"); // or a4,a1,a2 -AssertCode("remu\ta6,a1,t2", "33f87502"); // and a6,a1,t2 -AssertCode("fsw\tfs1,72(a1)", "27a49504"); // fsw fs1,288(a1) -AssertCode("fmadd.s\tfs10,ft10,ft5,fa0,rmm", "434d5f50"); // fmadd.s fs10,ft10,ft5,fa0 -AssertCode("fmsub.s\tft8,ft10,fs11,ft7,rdn", "472ebf39"); // fmsub.s ft8,ft10,fs11,ft7 -AssertCode("fnmsub.s\tfs7,fa4,fs3,fs0,rne", "cb0b3741"); // fnmsub.s fs7,fa4,fs3,fs0 -AssertCode("fnmadd.s\tfa4,ft4,fs5,fs0,rmm", "4f475241"); // fnmadd.s fa4,ft4,fs5,fs0 -AssertCode("fclass.s\ta3,fa2", "d31606e0"); // fmv.x.w a3,fa2 -AssertCode("fsd\tfs4,312(sp)", "273c4113"); // fsd fs4,2496(a0) -AssertCode("fmsub.d\tft0,ft0,fs0,fa6,rne", "47008082"); // fmsub.s ft0,ft0,fs0,fa6 -AssertCode("fnmsub.d\tfs0,ft4,ft2,fa5,rdn", "4b24227a"); // fnmsub.s fs0,ft4,ft2,fa5 -AssertCode("fnmadd.d\tfa2,ft10,ft5,fa0,rmm", "4f465f52"); // fnmadd.s fa2,ft10,ft5,fa0 -AssertCode("fcvt.l.d\tra,ft1,rtz", "d39020c2"); // fcvt.l.d ra,ft1 -AssertCode("fcvt.lu.d\ta0,fa3,rtz", "539536c2"); // fcvt.lu.d a0,fa3 - } - + + AssertCode("fence.i", "0f100000"); // invalid + AssertCode("csrrw\ts2,00000315,t0", "73995231"); // invalid + AssertCode("csrrs\ta1,sstatus,a5", "f3a50710"); // csrrs a1,sstatus,a5 + AssertCode("csrrc\ttp,000005F0,s0", "7332045f"); // invalid + AssertCode("csrrc\ttp,000005F0,zero", "7332005f"); // invalid + AssertCode("csrrsi\ts2,000006E6,0000001E", "73696f6e"); // invalid + AssertCode("csrrci\ts0,000006A5,0000001A", "73745d6a"); // invalid + AssertCode("mul\ta0,s5,s7", "33857a03"); // add a0,s5,s7 + AssertCode("mulh\tt5,a7,s1", "339f9802"); // sll t5,a7,s1 + AssertCode("mulhsu\tt3,sp,a6", "332e0103"); // slt t3,sp,a6 + AssertCode("mulhu\tt3,sp,a6", "333e0103"); // sltu t3,sp,a6 + AssertCode("mulhsu\tt3,sp,a6", "332e0103"); // slt t3,sp,a6 + AssertCode("divu\tt4,t3,t2", "b35e7e02"); // srl t4,t3,t2 + AssertCode("rem\ta4,a1,a2", "33e7c502"); // or a4,a1,a2 + AssertCode("remu\ta6,a1,t2", "33f87502"); // and a6,a1,t2 + AssertCode("fsw\tfs1,72(a1)", "27a49504"); // fsw fs1,288(a1) + AssertCode("fmadd.s\tfs10,ft10,ft5,fa0,rmm", "434d5f50"); // fmadd.s fs10,ft10,ft5,fa0 + AssertCode("fmsub.s\tft8,ft10,fs11,ft7,rdn", "472ebf39"); // fmsub.s ft8,ft10,fs11,ft7 + AssertCode("fnmsub.s\tfs7,fa4,fs3,fs0,rne", "cb0b3741"); // fnmsub.s fs7,fa4,fs3,fs0 + AssertCode("fnmadd.s\tfa4,ft4,fs5,fs0,rmm", "4f475241"); // fnmadd.s fa4,ft4,fs5,fs0 + AssertCode("fclass.s\ta3,fa2", "d31606e0"); // fmv.x.w a3,fa2 + AssertCode("fsd\tfs4,312(sp)", "273c4113"); // fsd fs4,2496(a0) + AssertCode("fmsub.d\tft0,ft0,fs0,fa6,rne", "47008082"); // fmsub.s ft0,ft0,fs0,fa6 + AssertCode("fnmsub.d\tfs0,ft4,ft2,fa5,rdn", "4b24227a"); // fnmsub.s fs0,ft4,ft2,fa5 + AssertCode("fnmadd.d\tfa2,ft10,ft5,fa0,rmm", "4f465f52"); // fnmadd.s fa2,ft10,ft5,fa0 + AssertCode("fcvt.l.d\tra,ft1,rtz", "d39020c2"); // fcvt.l.d ra,ft1 + AssertCode("fcvt.lu.d\ta0,fa3,rtz", "539536c2"); // fcvt.lu.d a0,fa3 + } + + [Test] + public void RiscV_dasm_sret() + { + AssertCode("sret", 0b0001000_00010_00000_000_00000_1110011); + } + + [Test] + public void RiscV_dasm_sfence_vma() + { + AssertCode("sfence.vma\ts5,0(s11)", 0b0001001_10101_11011_000_00000_1110011); + } + + [Test] + public void RiscV_dasm_sfence_w_inval() + { + AssertCode("sfence.w.inval", 0b0001100_00000_00000_000_00000_1110011); + } + + [Test] + public void RiscV_dasm_sfence_inval_ir() + { + AssertCode("sfence.inval.ir", 0b0001100_00001_00000_000_00000_1110011); + } + + [Test] + public void RiscV_dasm_hfence_vvma() + { + AssertCode("hfence.vvma\ts5,0(a7)", 0b0010001_10101_10001_000_00000_1110011); + } + + [Test] + public void RiscV_dasm_hfence_gvma() + { + AssertCode("hfence.gvma\ts5,0(a7)", 0b0110001_10101_10001_000_00000_1110011); + } + + [Test] + public void RiscV_dasm_hinval_vvma() + { + AssertCode("hinval.vvma\ts5,0(a7)", 0b0010011_10101_10001_000_00000_1110011); + } + + [Test] + public void RiscV_dasm_hinval_gvma() + { + AssertCode("hinval.gvma\ts5,0(a7)", 0b0110011_10101_10001_000_00000_1110011); + } + + [Test] + public void RiscV_dasm_hlv_b() + { + AssertCode("hlv.b\ts11,0(a7)", 0b0110000_00000_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hlv_bu() + { + AssertCode("hlv.bu\ts11,0(a7)", 0b0110000_00001_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hlv_h() + { + AssertCode("hlv.h\ts11,0(a7)", 0b0110010_00000_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hlv_hu() + { + AssertCode("hlv.hu\ts11,0(a7)", 0b0110010_00001_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hlvx_hu() + { + AssertCode("hlvx.hu\ts11,0(a7)", 0b0110010_00011_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hlv_w() + { + AssertCode("hlv.w\ts11,0(a7)", 0b0110100_00000_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hlvx_wu() + { + AssertCode("hlvx.wu\ts11,0(a7)", 0b0110100_00011_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hsv_b() + { + AssertCode("hsv.b\t0(a7),s5", 0b0110001_10101_10001_100_00000_1110011); + } + + [Test] + public void RiscV_dasm_hsv_h() + { + AssertCode("hsv.h\t0(a7),s5", 0b0110011_10101_10001_100_00000_1110011); + } + + [Test] + public void RiscV_dasm_hsv_w() + { + AssertCode("hsv.w\t0(a7),s5", 0b0110101_10101_10001_100_00000_1110011); + } + + [Test] + public void RiscV_dasm_hlv_wu() + { + AssertCode("hlv.wu\ts11,0(a7)", 0b0110100_00001_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hlv_d() + { + AssertCode("hlv.d\ts11,0(a7)", 0b0110110_00000_10001_100_11011_1110011); + } + + [Test] + public void RiscV_dasm_hsv_d() + { + AssertCode("hsv.d\t0(a7),s5", 0b0110111_10101_10001_100_00000_1110011); + } } -} +} \ No newline at end of file diff --git a/src/UnitTests/Arch/RiscV/RiscVRewriterTests.cs b/src/UnitTests/Arch/RiscV/RiscVRewriterTests.cs index 2406450354..bfc88ee1be 100644 --- a/src/UnitTests/Arch/RiscV/RiscVRewriterTests.cs +++ b/src/UnitTests/Arch/RiscV/RiscVRewriterTests.cs @@ -40,7 +40,7 @@ public class RiscVRewriterTests : RewriterTestBase private void Given_32bitFloat() { arch = new RiscVArchitecture( - CreateServiceContainer(), + CreateServiceContainer(), "riscV", new Dictionary { @@ -77,8 +77,6 @@ private void Given_32bit() private void Given_RiscVInstructions(params uint[] words) { - Reko.Core.Machine.Decoder.trace.Level = System.Diagnostics.TraceLevel.Verbose; - byte[] bytes; if ((words[0] & 0b11) != 0b11) { @@ -1923,7 +1921,7 @@ public void RiscV_rw_wfi() { Given_HexString("73005010"); AssertCode( // wfi - "0|L--|0000000000010000(4): 1 instructions", + "0|S--|0000000000010000(4): 1 instructions", "1|L--|__wait_for_interrupt()"); } @@ -1931,35 +1929,212 @@ public void RiscV_rw_wfi() // Please copy the contents of this file and report it on GitHub, using the // following URL: https://github.com/uxmal/reko/issues + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_73004010() + { + Given_HexString("73004010"); + AssertCode( // @@@ + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_73000012() + { + Given_HexString("73000012"); + AssertCode( // @@@ + "1|@@@"); + } - // This file contains unit tests automatically generated by Reko decompiler. - // Please copy the contents of this file and report it on GitHub, using the - // following URL: https://github.com/uxmal/reko/issues - - - - + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_sret() + { + Given_UInt32s(0b0001000_00010_00000_000_00000_1110011); + AssertCode( // @@@ + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_sfence_vma() + { + Given_UInt32s(0b0001001_10101_11011_000_00000_1110011); + AssertCode( // @@@ + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_sfence_w_inval() + { + Given_UInt32s(0b0001100_00000_00000_000_00000_1110011); + AssertCode( // sfence.w.inval + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_sfence_inval_ir() + { + Given_UInt32s(0b0001100_00001_00000_000_00000_1110011); + AssertCode( // sfence.inval.ir + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hfence_vvma() + { + Given_UInt32s(0b0010001_10101_10001_000_00000_1110011); + AssertCode( // hfence.vvma + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hfence_gvma() + { + Given_UInt32s(0b0110001_10101_10001_000_00000_1110011); + AssertCode( // hfence.gvma + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hinval_vvma() + { + Given_UInt32s(0b0010011_10101_10001_000_00000_1110011); + AssertCode( // hinval.vvma + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hinval_gvma() + { + Given_UInt32s(0b0110011_10101_10001_000_00000_1110011); + AssertCode( // hinval.gvma + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlv_b() + { + Given_UInt32s(0b0110000_00000_10001_100_11011_1110011); + AssertCode( // hlv.b + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlv_bu() + { + Given_UInt32s(0b0110000_00001_10001_100_11011_1110011); + AssertCode( // hlv.bu + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlv_h() + { + Given_UInt32s(0b0110010_00000_10001_100_11011_1110011); + AssertCode( // hlv.h + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlv_hu() + { + Given_UInt32s(0b0110010_00001_10001_100_11011_1110011); + AssertCode( // hlv.hu + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlvx_hu() + { + Given_UInt32s(0b0110010_00011_10001_100_11011_1110011); + AssertCode( // hlvx.hu + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlv_w() + { + Given_UInt32s(0b0110100_00000_10001_100_11011_1110011); + AssertCode( // hlv.w + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlvx_wu() + { + Given_UInt32s(0b0110100_00011_10001_100_11011_1110011); + AssertCode( // hlvx.wu + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hsv_b() + { + Given_UInt32s(0b0110001_10101_10001_100_00000_1110011); + AssertCode( // hsv.b + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hsv_h() + { + Given_UInt32s(0b0110011_10101_10001_100_00000_1110011); + AssertCode( // hsv.h + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hsv_w() + { + Given_UInt32s(0b0110101_10101_10001_100_00000_1110011); + AssertCode( // hsv.w + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlv_wu() + { + Given_UInt32s(0b0110100_00001_10001_100_11011_1110011); + AssertCode( // hlv.wu + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hlv_d() + { + Given_UInt32s(0b0110110_00000_10001_100_11011_1110011); + AssertCode( // hlv.d + "1|@@@"); + } + [Test] + [Ignore("Wait until disassembly has been verified")] + public void RiscV_rw_hsv_d() + { + Given_UInt32s(0b0110111_10101_10001_100_00000_1110011); + AssertCode( // hsv.d + "1|@@@"); + } } -} +} \ No newline at end of file diff --git a/subjects/regression.log b/subjects/regression.log index 827fc619cf..9f35453a7a 100644 --- a/subjects/regression.log +++ b/subjects/regression.log @@ -1169,8 +1169,8 @@ Signature of 'Microsoft Visual C++ 8' detected. 0000F240: warning: Unable to determine the upper bound of an indirect call or jump; there may be more than 2 entries. fn00008FF2: error: An error occurred while rewriting procedure to high-level language. Can't collapse fn00008FF2_entry (Tail) => l00008FF0_thunk_fn00008FF2) in procedure fn00008FF2 - at Reko.Structure.StructureAnalysis.CollapseToTailRegion(Region from, Region to, AbsynStatement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 960 - at Reko.Structure.StructureAnalysis.VirtualizeEdge(VirtualEdge vEdge) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 906 + at Reko.Structure.StructureAnalysis.CollapseToTailRegion(Region from, Region to, AbsynStatement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 982 + at Reko.Structure.StructureAnalysis.VirtualizeEdge(VirtualEdge vEdge) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 932 at Reko.Structure.StructureAnalysis.VirtualizeReturn(Region n) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 312 at Reko.Structure.StructureAnalysis.ProcessUnresolvedRegions() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 285 at Reko.Structure.StructureAnalysis.Execute() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 172 @@ -1455,7 +1455,7 @@ fn0001B2AC: error: An error occurred while rewriting procedure to high-level lan Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index') at Reko.Structure.CompoundConditionCoalescer.MaybeCoalesce(Block block) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\CompoundConditionCoalescer.cs:line 95 at Reko.Structure.CompoundConditionCoalescer.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\CompoundConditionCoalescer.cs:line 62 - at Reko.Structure.StructureAnalysis.Structure() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 78 + at Reko.Structure.StructureAnalysis.Structure() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 97 at Reko.Decompiler.StructureProgram() in d:\dev\uxmal\reko\master\src\Decompiler\Decompiler.cs:line 591 fn0001B2CC: warning: Structure analysis stopped making progress, quitting. Please report this issue at https://github.com/uxmal/reko 00000083: warning: Expected sizes of arrays to have been determined by now @@ -1643,6 +1643,7 @@ fn0800_1CF6: error: An error occurred while renaming variables. The given key 'l0800_1D54' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 128 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 90 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 118 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 105 at Reko.Analysis.WebBuilder.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 111 @@ -1650,6 +1651,7 @@ fn0800_2688: error: An error occurred while renaming variables. The given key 'l0800_2729' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 128 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 90 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 118 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 105 at Reko.Analysis.WebBuilder.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 111 @@ -1657,6 +1659,7 @@ fn0800_67BF: error: An error occurred while renaming variables. The given key 'l0800_6A7C' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 128 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 90 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 118 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 105 at Reko.Analysis.WebBuilder.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 111 @@ -1664,6 +1667,7 @@ fn0800_4F2C: error: An error occurred while renaming variables. The given key 'l0800_4F67' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 128 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 90 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 118 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 105 at Reko.Analysis.WebBuilder.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 111 @@ -1671,6 +1675,7 @@ fn0800_C177: error: An error occurred while renaming variables. The given key 'l0800_C22D' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 128 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 90 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 118 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 105 at Reko.Analysis.WebBuilder.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 111 @@ -2625,4 +2630,4 @@ varargs_test.exe: warning: Win32 X86-64 main procedure finder not implemented ye === PE\x86\VCExeSample\VCExeSample Signature of 'Microsoft Visual C++ 8' detected. -Decompiled 91 binaries in 72.05 seconds. +Decompiled 91 binaries in 67.44 seconds.