diff --git a/gen_input/templates/asmjit/CORENAME.cpp.gtl b/gen_input/templates/asmjit/CORENAME.cpp.gtl index 863628c..00e86e9 100644 --- a/gen_input/templates/asmjit/CORENAME.cpp.gtl +++ b/gen_input/templates/asmjit/CORENAME.cpp.gtl @@ -127,10 +127,18 @@ private: <%instr.fields.eachLine{%>${it} <%}%>if(this->disass_enabled){ /* generate disass */ + <%instr.disass.eachLine{%> + ${it}<%}%> + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\\n${instr.name}_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, ${idx}); pc=pc+ ${instr.length/8}; diff --git a/src/vm/asmjit/helper_func.h b/src/vm/asmjit/helper_func.h index f209e46..88aceba 100644 --- a/src/vm/asmjit/helper_func.h +++ b/src/vm/asmjit/helper_func.h @@ -1,4 +1,5 @@ - +#include +#include x86::Mem get_reg_ptr(jit_holder& jh, unsigned idx) { @@ -74,6 +75,7 @@ inline void write_reg_to_mem(jit_holder& jh, x86::Gp reg, unsigned idx) { void gen_instr_prologue(jit_holder& jh, addr_t pc) { auto& cc = jh.cc; + cc.mov(jh.pc, pc); cc.comment("\n//(*icount)++;"); cc.inc(get_reg_ptr(jh, traits::ICOUNT)); @@ -534,4 +536,4 @@ inline void gen_write_mem(jit_holder& jh, mem_type_e type, uint64_t addr, int64_ auto addr_reg = jh.cc.newUInt64(); jh.cc.mov(addr_reg, addr); gen_write_mem(jh, type, addr_reg, val_reg, length); -} \ No newline at end of file +} diff --git a/src/vm/asmjit/vm_tgc5c.cpp b/src/vm/asmjit/vm_tgc5c.cpp index 497cc1e..84b4a7e 100644 --- a/src/vm/asmjit/vm_tgc5c.cpp +++ b/src/vm/asmjit/vm_tgc5c.cpp @@ -300,10 +300,20 @@ private: uint32_t imm = ((bit_sub<12,20>(instr) << 12)); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm:#05x}", fmt::arg("mnemonic", "lui"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nLUI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 0); pc=pc+ 4; @@ -334,10 +344,20 @@ private: uint32_t imm = ((bit_sub<12,20>(instr) << 12)); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm:#08x}", fmt::arg("mnemonic", "auipc"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nAUIPC_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 1); pc=pc+ 4; @@ -368,10 +388,20 @@ private: uint32_t imm = ((bit_sub<12,8>(instr) << 12) | (bit_sub<20,1>(instr) << 11) | (bit_sub<21,10>(instr) << 1) | (bit_sub<31,1>(instr) << 20)); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm:#0x}", fmt::arg("mnemonic", "jal"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nJAL_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 2); pc=pc+ 4; @@ -411,10 +441,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {imm:#0x}", fmt::arg("mnemonic", "jalr"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nJALR_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 3); pc=pc+ 4; @@ -470,10 +510,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {rs2}, {imm:#0x}", fmt::arg("mnemonic", "beq"), + fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nBEQ_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 4); pc=pc+ 4; @@ -517,10 +567,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {rs2}, {imm:#0x}", fmt::arg("mnemonic", "bne"), + fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nBNE_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 5); pc=pc+ 4; @@ -564,10 +624,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {rs2}, {imm:#0x}", fmt::arg("mnemonic", "blt"), + fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nBLT_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 6); pc=pc+ 4; @@ -613,10 +683,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {rs2}, {imm:#0x}", fmt::arg("mnemonic", "bge"), + fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nBGE_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 7); pc=pc+ 4; @@ -662,10 +742,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {rs2}, {imm:#0x}", fmt::arg("mnemonic", "bltu"), + fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nBLTU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 8); pc=pc+ 4; @@ -709,10 +799,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {rs2}, {imm:#0x}", fmt::arg("mnemonic", "bgeu"), + fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nBGEU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 9); pc=pc+ 4; @@ -756,10 +856,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm}({rs1})", fmt::arg("mnemonic", "lb"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nLB_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 10); pc=pc+ 4; @@ -798,10 +908,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm}({rs1})", fmt::arg("mnemonic", "lh"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nLH_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 11); pc=pc+ 4; @@ -840,10 +960,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm}({rs1})", fmt::arg("mnemonic", "lw"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nLW_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 12); pc=pc+ 4; @@ -882,10 +1012,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm}({rs1})", fmt::arg("mnemonic", "lbu"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nLBU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 13); pc=pc+ 4; @@ -923,10 +1063,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm}({rs1})", fmt::arg("mnemonic", "lhu"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nLHU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 14); pc=pc+ 4; @@ -964,10 +1114,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs2}, {imm}({rs1})", fmt::arg("mnemonic", "sb"), + fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSB_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 15); pc=pc+ 4; @@ -1001,10 +1161,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs2}, {imm}({rs1})", fmt::arg("mnemonic", "sh"), + fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSH_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 16); pc=pc+ 4; @@ -1038,10 +1208,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs2}, {imm}({rs1})", fmt::arg("mnemonic", "sw"), + fmt::arg("rs2", name(rs2)), fmt::arg("imm", imm), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSW_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 17); pc=pc+ 4; @@ -1075,10 +1255,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {imm}", fmt::arg("mnemonic", "addi"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nADDI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 18); pc=pc+ 4; @@ -1113,10 +1303,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {imm}", fmt::arg("mnemonic", "slti"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSLTI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 19); pc=pc+ 4; @@ -1163,10 +1363,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {imm}", fmt::arg("mnemonic", "sltiu"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSLTIU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 20); pc=pc+ 4; @@ -1212,10 +1422,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {imm}", fmt::arg("mnemonic", "xori"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nXORI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 21); pc=pc+ 4; @@ -1249,10 +1469,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {imm}", fmt::arg("mnemonic", "ori"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nORI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 22); pc=pc+ 4; @@ -1286,10 +1516,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {imm}", fmt::arg("mnemonic", "andi"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nANDI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 23); pc=pc+ 4; @@ -1323,10 +1563,20 @@ private: uint8_t shamt = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {shamt}", fmt::arg("mnemonic", "slli"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("shamt", shamt)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSLLI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 24); pc=pc+ 4; @@ -1360,10 +1610,20 @@ private: uint8_t shamt = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {shamt}", fmt::arg("mnemonic", "srli"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("shamt", shamt)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSRLI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 25); pc=pc+ 4; @@ -1397,10 +1657,20 @@ private: uint8_t shamt = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {shamt}", fmt::arg("mnemonic", "srai"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("shamt", shamt)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSRAI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 26); pc=pc+ 4; @@ -1436,10 +1706,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "add"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nADD_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 27); pc=pc+ 4; @@ -1474,10 +1754,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "sub"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSUB_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 28); pc=pc+ 4; @@ -1512,10 +1802,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "sll"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSLL_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 29); pc=pc+ 4; @@ -1551,10 +1851,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "slt"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSLT_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 30); pc=pc+ 4; @@ -1602,10 +1912,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "sltu"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSLTU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 31); pc=pc+ 4; @@ -1651,10 +1971,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "xor"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nXOR_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 32); pc=pc+ 4; @@ -1688,10 +2018,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "srl"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSRL_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 33); pc=pc+ 4; @@ -1727,10 +2067,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "sra"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nSRA_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 34); pc=pc+ 4; @@ -1768,10 +2118,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "or"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nOR_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 35); pc=pc+ 4; @@ -1805,10 +2165,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "and"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nAND_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 36); pc=pc+ 4; @@ -1844,10 +2214,20 @@ private: uint8_t fm = ((bit_sub<28,4>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {pred}, {succ} ({fm} , {rs1}, {rd})", fmt::arg("mnemonic", "fence"), + fmt::arg("pred", pred), fmt::arg("succ", succ), fmt::arg("fm", fm), fmt::arg("rs1", name(rs1)), fmt::arg("rd", name(rd))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nFENCE_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 37); pc=pc+ 4; @@ -1868,10 +2248,19 @@ private: uint64_t PC = pc.val; if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "ecall"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nECALL_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 38); pc=pc+ 4; @@ -1892,10 +2281,19 @@ private: uint64_t PC = pc.val; if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "ebreak"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nEBREAK_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 39); pc=pc+ 4; @@ -1916,10 +2314,19 @@ private: uint64_t PC = pc.val; if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "mret"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nMRET_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 40); pc=pc+ 4; @@ -1940,10 +2347,19 @@ private: uint64_t PC = pc.val; if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "wfi"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nWFI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 41); pc=pc+ 4; @@ -1967,10 +2383,20 @@ private: uint16_t csr = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {csr}, {rs1}", fmt::arg("mnemonic", "csrrw"), + fmt::arg("rd", name(rd)), fmt::arg("csr", csr), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nCSRRW_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 42); pc=pc+ 4; @@ -2008,10 +2434,20 @@ private: uint16_t csr = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {csr}, {rs1}", fmt::arg("mnemonic", "csrrs"), + fmt::arg("rd", name(rd)), fmt::arg("csr", csr), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nCSRRS_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 43); pc=pc+ 4; @@ -2050,10 +2486,20 @@ private: uint16_t csr = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {csr}, {rs1}", fmt::arg("mnemonic", "csrrc"), + fmt::arg("rd", name(rd)), fmt::arg("csr", csr), fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nCSRRC_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 44); pc=pc+ 4; @@ -2092,10 +2538,20 @@ private: uint16_t csr = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {csr}, {zimm:#0x}", fmt::arg("mnemonic", "csrrwi"), + fmt::arg("rd", name(rd)), fmt::arg("csr", csr), fmt::arg("zimm", zimm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nCSRRWI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 45); pc=pc+ 4; @@ -2129,10 +2585,20 @@ private: uint16_t csr = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {csr}, {zimm:#0x}", fmt::arg("mnemonic", "csrrsi"), + fmt::arg("rd", name(rd)), fmt::arg("csr", csr), fmt::arg("zimm", zimm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nCSRRSI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 46); pc=pc+ 4; @@ -2170,10 +2636,20 @@ private: uint16_t csr = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {csr}, {zimm:#0x}", fmt::arg("mnemonic", "csrrci"), + fmt::arg("rd", name(rd)), fmt::arg("csr", csr), fmt::arg("zimm", zimm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nCSRRCI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 47); pc=pc+ 4; @@ -2211,10 +2687,20 @@ private: uint16_t imm = ((bit_sub<20,12>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {rd}, {imm}", fmt::arg("mnemonic", "fence_i"), + fmt::arg("rs1", name(rs1)), fmt::arg("rd", name(rd)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nFENCE_I_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 48); pc=pc+ 4; @@ -2238,10 +2724,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "mul"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nMUL_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 49); pc=pc+ 4; @@ -2282,10 +2778,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "mulh"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nMULH_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 50); pc=pc+ 4; @@ -2328,10 +2834,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "mulhsu"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nMULHSU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 51); pc=pc+ 4; @@ -2373,10 +2889,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "mulhu"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nMULHU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 52); pc=pc+ 4; @@ -2417,10 +2943,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "div"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nDIV_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 53); pc=pc+ 4; @@ -2494,10 +3030,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "divu"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nDIVU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 54); pc=pc+ 4; @@ -2549,10 +3095,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "rem"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nREM_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 55); pc=pc+ 4; @@ -2630,10 +3186,20 @@ private: uint8_t rs2 = ((bit_sub<20,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs1}, {rs2}", fmt::arg("mnemonic", "remu"), + fmt::arg("rd", name(rd)), fmt::arg("rs1", name(rs1)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nREMU_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 56); pc=pc+ 4; @@ -2683,10 +3249,20 @@ private: uint16_t imm = ((bit_sub<5,1>(instr) << 3) | (bit_sub<6,1>(instr) << 2) | (bit_sub<7,4>(instr) << 6) | (bit_sub<11,2>(instr) << 4)); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm:#05x}", fmt::arg("mnemonic", "c__addi4spn"), + fmt::arg("rd", name(8+rd)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__ADDI4SPN_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 57); pc=pc+ 2; @@ -2719,10 +3295,20 @@ private: uint8_t rs1 = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {uimm:#05x}({rs1})", fmt::arg("mnemonic", "c__lw"), + fmt::arg("rd", name(8+rd)), fmt::arg("uimm", uimm), fmt::arg("rs1", name(8+rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__LW_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 58); pc=pc+ 2; @@ -2753,10 +3339,20 @@ private: uint8_t rs1 = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs2}, {uimm:#05x}({rs1})", fmt::arg("mnemonic", "c__sw"), + fmt::arg("rs2", name(8+rs2)), fmt::arg("uimm", uimm), fmt::arg("rs1", name(8+rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__SW_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 59); pc=pc+ 2; @@ -2784,10 +3380,20 @@ private: uint8_t rs1 = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {imm:#05x}", fmt::arg("mnemonic", "c__addi"), + fmt::arg("rs1", name(rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__ADDI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 60); pc=pc+ 2; @@ -2820,10 +3426,19 @@ private: uint8_t nzimm = ((bit_sub<2,5>(instr)) | (bit_sub<12,1>(instr) << 5)); if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "c__nop"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__NOP_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 61); pc=pc+ 2; @@ -2844,10 +3459,20 @@ private: uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,3>(instr) << 1) | (bit_sub<6,1>(instr) << 7) | (bit_sub<7,1>(instr) << 6) | (bit_sub<8,1>(instr) << 10) | (bit_sub<9,2>(instr) << 8) | (bit_sub<11,1>(instr) << 4) | (bit_sub<12,1>(instr) << 11)); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {imm:#05x}", fmt::arg("mnemonic", "c__jal"), + fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__JAL_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 62); pc=pc+ 2; @@ -2874,10 +3499,20 @@ private: uint8_t rd = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm:#05x}", fmt::arg("mnemonic", "c__li"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__LI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 63); pc=pc+ 2; @@ -2908,10 +3543,20 @@ private: uint8_t rd = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {imm:#05x}", fmt::arg("mnemonic", "c__lui"), + fmt::arg("rd", name(rd)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__LUI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 64); pc=pc+ 2; @@ -2939,10 +3584,20 @@ private: uint16_t nzimm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,2>(instr) << 7) | (bit_sub<5,1>(instr) << 6) | (bit_sub<6,1>(instr) << 4) | (bit_sub<12,1>(instr) << 9)); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {nzimm:#05x}", fmt::arg("mnemonic", "c__addi16sp"), + fmt::arg("nzimm", nzimm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__ADDI16SP_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 65); pc=pc+ 2; @@ -2973,10 +3628,19 @@ private: uint8_t rd = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "__reserved_clui"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\n__reserved_clui_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 66); pc=pc+ 2; @@ -2999,10 +3663,20 @@ private: uint8_t rs1 = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {shamt}", fmt::arg("mnemonic", "c__srli"), + fmt::arg("rs1", name(8+rs1)), fmt::arg("shamt", shamt)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__SRLI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 67); pc=pc+ 2; @@ -3028,10 +3702,20 @@ private: uint8_t rs1 = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {shamt}", fmt::arg("mnemonic", "c__srai"), + fmt::arg("rs1", name(8+rs1)), fmt::arg("shamt", shamt)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__SRAI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 68); pc=pc+ 2; @@ -3071,10 +3755,20 @@ private: uint8_t rs1 = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {imm:#05x}", fmt::arg("mnemonic", "c__andi"), + fmt::arg("rs1", name(8+rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__ANDI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 69); pc=pc+ 2; @@ -3101,10 +3795,20 @@ private: uint8_t rd = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs2}", fmt::arg("mnemonic", "c__sub"), + fmt::arg("rd", name(8+rd)), fmt::arg("rs2", name(8+rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__SUB_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 70); pc=pc+ 2; @@ -3131,10 +3835,20 @@ private: uint8_t rd = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs2}", fmt::arg("mnemonic", "c__xor"), + fmt::arg("rd", name(8+rd)), fmt::arg("rs2", name(8+rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__XOR_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 71); pc=pc+ 2; @@ -3160,10 +3874,20 @@ private: uint8_t rd = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs2}", fmt::arg("mnemonic", "c__or"), + fmt::arg("rd", name(8+rd)), fmt::arg("rs2", name(8+rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__OR_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 72); pc=pc+ 2; @@ -3189,10 +3913,20 @@ private: uint8_t rd = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs2}", fmt::arg("mnemonic", "c__and"), + fmt::arg("rd", name(8+rd)), fmt::arg("rs2", name(8+rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__AND_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 73); pc=pc+ 2; @@ -3217,10 +3951,20 @@ private: uint16_t imm = ((bit_sub<2,1>(instr) << 5) | (bit_sub<3,3>(instr) << 1) | (bit_sub<6,1>(instr) << 7) | (bit_sub<7,1>(instr) << 6) | (bit_sub<8,1>(instr) << 10) | (bit_sub<9,2>(instr) << 8) | (bit_sub<11,1>(instr) << 4) | (bit_sub<12,1>(instr) << 11)); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {imm:#05x}", fmt::arg("mnemonic", "c__j"), + fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__J_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 74); pc=pc+ 2; @@ -3245,10 +3989,20 @@ private: uint8_t rs1 = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {imm:#05x}", fmt::arg("mnemonic", "c__beqz"), + fmt::arg("rs1", name(8+rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__BEQZ_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 75); pc=pc+ 2; @@ -3281,10 +4035,20 @@ private: uint8_t rs1 = ((bit_sub<7,3>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {imm:#05x}", fmt::arg("mnemonic", "c__bnez"), + fmt::arg("rs1", name(8+rs1)), fmt::arg("imm", imm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__BNEZ_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 76); pc=pc+ 2; @@ -3317,10 +4081,20 @@ private: uint8_t rs1 = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}, {nzuimm}", fmt::arg("mnemonic", "c__slli"), + fmt::arg("rs1", name(rs1)), fmt::arg("nzuimm", nzuimm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__SLLI_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 77); pc=pc+ 2; @@ -3353,10 +4127,20 @@ private: uint8_t rd = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, sp, {uimm:#05x}", fmt::arg("mnemonic", "c__lwsp"), + fmt::arg("rd", name(rd)), fmt::arg("uimm", uimm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__LWSP_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 78); pc=pc+ 2; @@ -3391,10 +4175,20 @@ private: uint8_t rd = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs2}", fmt::arg("mnemonic", "c__mv"), + fmt::arg("rd", name(rd)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__MV_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 79); pc=pc+ 2; @@ -3424,10 +4218,20 @@ private: uint8_t rs1 = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}", fmt::arg("mnemonic", "c__jr"), + fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__JR_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 80); pc=pc+ 2; @@ -3457,10 +4261,19 @@ private: uint64_t PC = pc.val; if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "__reserved_cmv"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\n__reserved_cmv_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 81); pc=pc+ 2; @@ -3483,10 +4296,20 @@ private: uint8_t rd = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rd}, {rs2}", fmt::arg("mnemonic", "c__add"), + fmt::arg("rd", name(rd)), fmt::arg("rs2", name(rs2))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__ADD_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 82); pc=pc+ 2; @@ -3519,10 +4342,20 @@ private: uint8_t rs1 = ((bit_sub<7,5>(instr))); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs1}", fmt::arg("mnemonic", "c__jalr"), + fmt::arg("rs1", name(rs1))); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__JALR_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 83); pc=pc+ 2; @@ -3555,10 +4388,19 @@ private: uint64_t PC = pc.val; if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "c__ebreak"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__EBREAK_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 84); pc=pc+ 2; @@ -3581,10 +4423,20 @@ private: uint8_t uimm = ((bit_sub<7,2>(instr) << 6) | (bit_sub<9,4>(instr) << 2)); if(this->disass_enabled){ /* generate disass */ + + auto mnemonic = fmt::format( + "{mnemonic:10} {rs2}, {uimm:#05x}(sp)", fmt::arg("mnemonic", "c__swsp"), + fmt::arg("rs2", name(rs2)), fmt::arg("uimm", uimm)); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nC__SWSP_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 85); pc=pc+ 2; @@ -3615,10 +4467,19 @@ private: uint64_t PC = pc.val; if(this->disass_enabled){ /* generate disass */ + + //This disass is not yet implemented + std::string mnemonic = "dii"; + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignatureT()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } x86::Compiler& cc = jh.cc; - //ideally only do this if necessary (someone / plugin needs it) - cc.mov(jh.pc,PC); cc.comment(fmt::format("\nDII_{:#x}:",pc.val).c_str()); this->gen_sync(jh, PRE_SYNC, 86); pc=pc+ 2;