VMProfiler  v1.8
vmprofiler is a c++ library which is used to statically analyze VMProtect 2 polymorphic virtual machines. This project is inherited in vmprofiler-qt, vmprofiler-cli, and vmemu.
vmlifters.hpp
Go to the documentation of this file.
1 #include <vmp2.hpp>
2 #include <vmprofiles.hpp>
3 #include <vtil/vtil>
4 
5 namespace vm::lifters
6 {
7  using lifter_callback_t = std::function< void( vtil::basic_block *, vm::instrs::virt_instr_t *, vmp2::v3::code_block_t* ) >;
8  using lifter_t = std::pair< vm::handler::mnemonic_t, lifter_callback_t >;
9 
10  // taken from
11  // https://github.com/can1357/NoVmp/blob/6c23c9a335f70e8d5ed6299668fd802f2314c896/NoVmp/vmprotect/il2vtil.cpp#L66
12  inline constexpr vtil::register_desc make_virtual_register( uint8_t context_offset, uint8_t size )
13  {
14  fassert( ( ( context_offset & 7 ) + size ) <= 8 && size );
15 
16  return { vtil::register_virtual, ( size_t )context_offset / 8, size * 8, ( context_offset % 8 ) * 8 };
17  }
18 
27 
33 
34  inline std::vector< vm::lifters::lifter_t * > all = {
35  // lreg lifters...
36  &lregq, &lregdw,
37 
38  // add lifters...
39  &addq, &adddw, &addw,
40 
41  // sreg lifters...
42  &sregq, &sregdw, &sregw,
43 
44  // lconst lifters...
46 
47  // nand lifters...
48  &nandq, &nanddw, &nandw,
49 
50  // read lifters....
51  &readq, &readdw, &readw,
52 
53  // shr lifters...
54  &shrq, &shrw,
55 
56  // pushvsp lifter...
57  &pushvsp,
58 
59  // jmp lifter...
60  &jmp,
61 
62  // lflags lifter...
63  &lrflags,
64 
65  // lvsp lifter...
66  &lvsp,
67 
68  // vmexit lifter...
69  &vmexit };
70 } // namespace vm::lifters
Definition: vmlifters.hpp:6
vm::lifters::lifter_t lconstwsxdw
Definition: vmlifters.hpp:23
vm::lifters::lifter_t addq
Definition: add.cpp:5
vm::lifters::lifter_t shrw
Definition: vmlifters.hpp:26
vm::lifters::lifter_t addw
Definition: vmlifters.hpp:20
vm::lifters::lifter_t lconstwsxq
Definition: vmlifters.hpp:23
vm::lifters::lifter_t readdw
Definition: vmlifters.hpp:25
vm::lifters::lifter_t sregdw
Definition: vmlifters.hpp:21
vm::lifters::lifter_t lrflags
Definition: lflags.cpp:5
vm::lifters::lifter_t lregdw
Definition: vmlifters.hpp:19
vm::lifters::lifter_t readq
Definition: read.cpp:5
vm::lifters::lifter_t lconstdw
Definition: vmlifters.hpp:22
vm::lifters::lifter_t readw
Definition: vmlifters.hpp:25
vm::lifters::lifter_t jmp
Definition: jmp.cpp:5
vm::lifters::lifter_t lconstq
Definition: lconst.cpp:5
vm::lifters::lifter_t lconstbsxdw
Definition: vmlifters.hpp:22
vm::lifters::lifter_t adddw
Definition: vmlifters.hpp:20
std::vector< vm::lifters::lifter_t * > all
Definition: vmlifters.hpp:34
vm::lifters::lifter_t vmexit
Definition: vmexit.cpp:5
vm::lifters::lifter_t lregq
Definition: lreg.cpp:5
vm::lifters::lifter_t nandq
Definition: nand.cpp:5
vm::lifters::lifter_t lconstbsxq
Definition: vmlifters.hpp:22
vm::lifters::lifter_t nanddw
Definition: vmlifters.hpp:24
vm::lifters::lifter_t sregw
Definition: vmlifters.hpp:21
vm::lifters::lifter_t nandw
Definition: vmlifters.hpp:24
constexpr vtil::register_desc make_virtual_register(uint8_t context_offset, uint8_t size)
Definition: vmlifters.hpp:12
vm::lifters::lifter_t lvsp
Definition: lvsp.cpp:5
std::function< void(vtil::basic_block *, vm::instrs::virt_instr_t *, vmp2::v3::code_block_t *) > lifter_callback_t
Definition: vmlifters.hpp:7
vm::lifters::lifter_t sregq
Definition: sreg.cpp:5
vm::lifters::lifter_t lconstw
Definition: vmlifters.hpp:22
std::pair< vm::handler::mnemonic_t, lifter_callback_t > lifter_t
Definition: vmlifters.hpp:8
vm::lifters::lifter_t lconstbzxw
Definition: vmlifters.hpp:22
vm::lifters::lifter_t pushvsp
Definition: pushvsp.cpp:5
vm::lifters::lifter_t shrq
Definition: shr.cpp:5
vm::lifters::lifter_t lconstdwsxq
Definition: vmlifters.hpp:22
Definition: vmp2.hpp:150
Definition: vmp2.hpp:217