You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vmprofiler/include/vmlifters.hpp

32 lines
1.1 KiB

#include <vmp2.hpp>
#include <vmprofiles.hpp>
#include <vtil/vtil>
namespace vm::lifters
{
using lifter_callback_t = std::function< void( vtil::basic_block *, vm::instrs::virt_instr_t * ) >;
using lifter_t = std::pair< vm::handler::mnemonic_t, lifter_callback_t >;
// taken from
// https://github.com/can1357/NoVmp/blob/6c23c9a335f70e8d5ed6299668fd802f2314c896/NoVmp/vmprotect/il2vtil.cpp#L66
inline constexpr vtil::register_desc make_virtual_register( uint8_t context_offset, uint8_t size )
{
fassert( ( ( context_offset & 7 ) + size ) <= 8 && size );
return { vtil::register_virtual, ( size_t )context_offset / 8, size * 8, ( context_offset % 8 ) * 8 };
}
extern vm::lifters::lifter_t lregq, lregdw;
extern vm::lifters::lifter_t addq, adddw, addw;
extern vm::lifters::lifter_t sregq, sregdw, sregw;
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