adds disass functionality

This commit is contained in:
Eyck-Alexander Jentzsch 2024-03-07 13:58:08 +01:00
parent 119d4a8b43
commit 1e6a0086e9
3 changed files with 1049 additions and 178 deletions

View File

@ -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<void, void *, uint64_t, char *>());
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};

View File

@ -1,4 +1,5 @@
#include <asmjit/asmjit.h>
#include <iss/asmjit/jit_helper.h>
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));

File diff suppressed because it is too large Load Diff