adds disass functionality
This commit is contained in:
parent
119d4a8b43
commit
1e6a0086e9
|
@ -127,10 +127,18 @@ private:
|
||||||
<%instr.fields.eachLine{%>${it}
|
<%instr.fields.eachLine{%>${it}
|
||||||
<%}%>if(this->disass_enabled){
|
<%}%>if(this->disass_enabled){
|
||||||
/* generate disass */
|
/* 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;
|
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());
|
cc.comment(fmt::format("\\n${instr.name}_{:#x}:",pc.val).c_str());
|
||||||
this->gen_sync(jh, PRE_SYNC, ${idx});
|
this->gen_sync(jh, PRE_SYNC, ${idx});
|
||||||
pc=pc+ ${instr.length/8};
|
pc=pc+ ${instr.length/8};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
#include <asmjit/asmjit.h>
|
||||||
|
#include <iss/asmjit/jit_helper.h>
|
||||||
|
|
||||||
x86::Mem get_reg_ptr(jit_holder& jh, unsigned idx) {
|
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) {
|
void gen_instr_prologue(jit_holder& jh, addr_t pc) {
|
||||||
auto& cc = jh.cc;
|
auto& cc = jh.cc;
|
||||||
|
cc.mov(jh.pc, pc);
|
||||||
|
|
||||||
cc.comment("\n//(*icount)++;");
|
cc.comment("\n//(*icount)++;");
|
||||||
cc.inc(get_reg_ptr(jh, traits::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();
|
auto addr_reg = jh.cc.newUInt64();
|
||||||
jh.cc.mov(addr_reg, addr);
|
jh.cc.mov(addr_reg, addr);
|
||||||
gen_write_mem(jh, type, addr_reg, val_reg, length);
|
gen_write_mem(jh, type, addr_reg, val_reg, length);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue