diff --git a/include/vmlifters.hpp b/include/vmlifters.hpp index e6f7179..feedcdf 100644 --- a/include/vmlifters.hpp +++ b/include/vmlifters.hpp @@ -19,6 +19,8 @@ namespace vm::lifters extern vm::lifters::lifter_t lregq, lregdw; extern vm::lifters::lifter_t addq, adddw, addw; extern vm::lifters::lifter_t sregq, sregdw, sregw; + extern vm::lifters::lifter_t lconstq, lconstdw, lconstw; + extern vm::lifters::lifter_t vmexit; inline std::map< vm::handler::mnemonic_t, lifter_callback_t > all = { // lreg lifters... @@ -28,5 +30,11 @@ namespace vm::lifters addq, adddw, addw, // sreg lifters... - sregq, sregdw, sregw }; + sregq, sregdw, sregw, + + // lconst lifters... + lconstq, lconstdw, lconstw, + + // vmexit lifter... + vmexit }; } // namespace vm::lifters \ No newline at end of file diff --git a/src/vmlifters/lconst.cpp b/src/vmlifters/lconst.cpp new file mode 100644 index 0000000..a9e54c8 --- /dev/null +++ b/src/vmlifters/lconst.cpp @@ -0,0 +1,22 @@ +#include + +namespace vm::lifters +{ + vm::lifters::lifter_t lconstq = { + // push imm + vm::handler::LCONSTQ, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { + blk->push( vtil::operand( vinstr->operand.imm.u, 64 ) ); + } }; + + vm::lifters::lifter_t lconstdw = { + // push imm + vm::handler::LCONSTDW, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { + blk->push( vtil::operand( vinstr->operand.imm.u, 32 ) ); + } }; + + vm::lifters::lifter_t lconstw = { + // push imm + vm::handler::LCONSTW, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { + blk->push( vtil::operand( vinstr->operand.imm.u, 16 ) ); + } }; +} // namespace vm::lifters \ No newline at end of file diff --git a/src/vmlifters/vmexit.cpp b/src/vmlifters/vmexit.cpp new file mode 100644 index 0000000..254e17b --- /dev/null +++ b/src/vmlifters/vmexit.cpp @@ -0,0 +1,8 @@ +#include + +namespace vm::lifters +{ + vm::lifters::lifter_t vmexit = { + // ret + vm::handler::VMEXIT, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { blk->vexit(); } }; +} \ No newline at end of file diff --git a/vmprofiler.vcxproj b/vmprofiler.vcxproj index 0b0bbd6..510b98a 100644 --- a/vmprofiler.vcxproj +++ b/vmprofiler.vcxproj @@ -168,8 +168,10 @@ + + diff --git a/vmprofiler.vcxproj.filters b/vmprofiler.vcxproj.filters index b6c647e..7c4ef1d 100644 --- a/vmprofiler.vcxproj.filters +++ b/vmprofiler.vcxproj.filters @@ -267,5 +267,11 @@ Source Files\vmlifters + + Source Files\vmlifters + + + Source Files\vmlifters + \ No newline at end of file