updated vmexit handler, updated vmprofiler dep... updated main.cpp

merge-requests/11/head
_xeroxz 3 years ago
parent cfb244c93c
commit a2b532cfff

@ -1 +1 @@
Subproject commit 90106b0f5e748f1e67e108800ee0463bae5755e3
Subproject commit 051140175db16b38acee882cfca714b4a1000a41

@ -85,23 +85,6 @@ namespace vm
bool devirt_t::compile( std::vector< std::uint8_t > &obj )
{
llvm::legacy::FunctionPassManager pass_mgr( llvm_module );
pass_mgr.add( llvm::createPromoteMemoryToRegisterPass() );
pass_mgr.add( llvm::createCFGSimplificationPass() );
pass_mgr.add( llvm::createSROAPass() );
pass_mgr.add( llvm::createLoopSimplifyCFGPass() );
pass_mgr.add( llvm::createNewGVNPass() );
pass_mgr.add( llvm::createReassociatePass() );
pass_mgr.add( llvm::createPartiallyInlineLibCallsPass() );
pass_mgr.add( llvm::createDeadCodeEliminationPass() );
pass_mgr.add( llvm::createCFGSimplificationPass() );
pass_mgr.add( llvm::createInstructionCombiningPass() );
pass_mgr.add( llvm::createFlattenCFGPass() );
for ( auto vmp_rtn : vmp_rtns )
pass_mgr.run( *vmp_rtn->llvm_fptr );
// compile to native x86_64....
llvm::TargetOptions opt;
llvm::SmallVector< char, 128 > buff;
llvm::raw_svector_ostream dest( buff );

@ -12,7 +12,7 @@ namespace devirt
if ( file_header->version != vmp2::version_t::v4 )
{
std::printf( "[!] invalid vmp2 file version... this build uses v3...\n" );
std::printf( "[!] invalid vmp2 file version... this build uses v4...\n" );
return false;
}

@ -8,8 +8,8 @@ namespace vm
llvm::IRBuilder<> *ir_builder ) {
std::stringstream rtn_name;
llvm::Function *exit_func = nullptr;
rtn_name << "vmexit_" << std::hex << vinstr.trace_data.vm_handler_rva + rtn->vmp2_file->image_base;
if ( !( exit_func = rtn->llvm_module->getFunction( rtn_name.str() ) ) )
{
auto vmexit_func_type = llvm::FunctionType::get(
@ -58,4 +58,4 @@ namespace vm
ir_builder->CreateCall( exit_func, stack_ptr );
ir_builder->CreateRet( stack_ptr );
};
}
} // namespace vm

@ -64,6 +64,7 @@ int main( int argc, const char *argv[] )
{
std::printf( "[!] failed to lift rtn_0x%p, please review the console...\n",
vm_enter_offset + file_header->image_base );
return -1;
}
}

Loading…
Cancel
Save