#include #include #include #include #include #define VM_ENTER_NAME "vmenter_" #define VM_EXIT_NAME "vmexit_" #define VM_RTN_NAME "rtn_" #define FIX_MAKE_ZERO_OFFSET 0x25 #define FIX_MAKE_RELOC_OFFSET 0x30 #define FIX_MAKE_JMP_OFFSET 0x43 namespace devirt { namespace util { /// /// helper function to serialize vmp2 file data to vm::instr::code_block's... /// /// vector of pairs {vm enter offset, vector of code blocks} which gets filled up with /// serialized data /// a vector of bytes containing the vmp2 file... /// returns true if serialization was successful bool serialize_vmp2( std::vector< std::pair< std::uint32_t, std::vector< vm::instrs::code_block_t > > > &virt_rtns, std::vector< std::uint8_t > &vmp2file ); } // namespace util /// /// append devirtualized functions to the original binary... patches vm enter jmps to devirtualized code... /// /// compiled obj file... generated by llvm... /// original binary in a vector... this binary gets patched... /// returns true if new .devirt section has been appended and all linking was successful... bool append( std::vector< std::uint8_t > &obj, std::vector< std::uint8_t > &bin ); } // namespace devirt