From 0699518ae99dde9716302c84588bcced13bf648f Mon Sep 17 00:00:00 2001 From: _xeroxz Date: Thu, 10 Jun 2021 17:16:19 -0700 Subject: [PATCH] added more lifters... --- include/vmlifters.hpp | 15 +++++++++++---- src/vmlifters/{lregq.cpp => lreg.cpp} | 8 +++++++- src/vmlifters/sreg.cpp | 22 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) rename src/vmlifters/{lregq.cpp => lreg.cpp} (51%) create mode 100644 src/vmlifters/sreg.cpp diff --git a/include/vmlifters.hpp b/include/vmlifters.hpp index 0c764a5..d1da347 100644 --- a/include/vmlifters.hpp +++ b/include/vmlifters.hpp @@ -16,10 +16,17 @@ namespace vm::lifters return { vtil::register_virtual, ( size_t )context_offset / 8, size * 8, ( context_offset % 8 ) * 8 }; } - extern lifter_t lregq; + extern lifter_t lregq, lregdw; extern lifter_t addq, adddw, addw; + extern lifter_t sregq, sregdw, sregw; - inline std::map< vm::handler::mnemonic_t, lifter_callback_t > all = { - lregq, addq, adddw, addw - }; + inline std::map< vm::handler::mnemonic_t, lifter_callback_t > all = { + // lreg lifters... + lregq, lregdw, + + // add lifters... + addq, adddw, addw, + + // sreg lifters... + sregq, sregdw, sregw }; } // namespace vm::lifters \ No newline at end of file diff --git a/src/vmlifters/lregq.cpp b/src/vmlifters/lreg.cpp similarity index 51% rename from src/vmlifters/lregq.cpp rename to src/vmlifters/lreg.cpp index 8eecf0a..7db2ad8 100644 --- a/src/vmlifters/lregq.cpp +++ b/src/vmlifters/lreg.cpp @@ -7,4 +7,10 @@ namespace vm::lifters vm::handler::LREGQ, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { blk->push( make_virtual_register( vinstr->operand.imm.u, 8 ) ); } }; -} \ No newline at end of file + + lifter_t lregdw = { + // push vregX + vm::handler::LREGDW, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { + blk->push( make_virtual_register( vinstr->operand.imm.u, 4 ) ); + } }; +} // namespace vm::lifters \ No newline at end of file diff --git a/src/vmlifters/sreg.cpp b/src/vmlifters/sreg.cpp new file mode 100644 index 0000000..59022e4 --- /dev/null +++ b/src/vmlifters/sreg.cpp @@ -0,0 +1,22 @@ +#include + +namespace vm::lifters +{ + lifter_t sregq = { + // pop vregX + vm::handler::SREGQ, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { + blk->pop( make_virtual_register( vinstr->operand.imm.u, 8 ) ); + } }; + + lifter_t sregdw = { + // pop vregX + vm::handler::SREGDW, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { + blk->pop( make_virtual_register( vinstr->operand.imm.u, 4 ) ); + } }; + + lifter_t sregw = { + // pop vregX + vm::handler::SREGW, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { + blk->pop( make_virtual_register( vinstr->operand.imm.u, 2 ) ); + } }; +} // namespace vm::lifters \ No newline at end of file