|
|
@ -15,8 +15,12 @@ namespace vm
|
|
|
|
flags = ir_builder->CreateAlloca( ir_builder->getInt64Ty(), nullptr, "flags" );
|
|
|
|
flags = ir_builder->CreateAlloca( ir_builder->getInt64Ty(), nullptr, "flags" );
|
|
|
|
|
|
|
|
|
|
|
|
create_virtual_stack();
|
|
|
|
create_virtual_stack();
|
|
|
|
// TODO: copy arg1 (array) onto the local stack...
|
|
|
|
for ( auto idx = 0u; idx < 21; ++idx )
|
|
|
|
// ir_builder->CreateMemCpy(...
|
|
|
|
{
|
|
|
|
|
|
|
|
auto val = ir_builder->CreateLoad( llvm_fptr->getArg( idx ) );
|
|
|
|
|
|
|
|
val->setAlignment( llvm::Align( 1 ) );
|
|
|
|
|
|
|
|
push( 8, val );
|
|
|
|
|
|
|
|
}
|
|
|
|
create_virtual_registers();
|
|
|
|
create_virtual_registers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -31,11 +35,11 @@ namespace vm
|
|
|
|
|
|
|
|
|
|
|
|
void vmp_rtn_t::create_routine( void )
|
|
|
|
void vmp_rtn_t::create_routine( void )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// function has no arguments and returns void... maybe change this in the future as i learn
|
|
|
|
std::vector< llvm::Type * > arg_types;
|
|
|
|
// more and more LLVM...
|
|
|
|
for ( auto idx = 0u; idx < 21; ++idx )
|
|
|
|
auto func_ty =
|
|
|
|
arg_types.push_back( llvm::PointerType::get( llvm::IntegerType::get( *llvm_ctx, 64 ), 0ull ) );
|
|
|
|
llvm::FunctionType::get( llvm::Type::getVoidTy( *llvm_ctx ),
|
|
|
|
|
|
|
|
{ llvm::ArrayType::get( llvm::IntegerType::get( *llvm_ctx, 64 ), 21 ) }, false );
|
|
|
|
auto func_ty = llvm::FunctionType::get( llvm::Type::getVoidTy( *llvm_ctx ), arg_types, false );
|
|
|
|
|
|
|
|
|
|
|
|
// convert the rtn_begin address to a hex string and prepend "rtn_" to it...
|
|
|
|
// convert the rtn_begin address to a hex string and prepend "rtn_" to it...
|
|
|
|
std::stringstream rtn_name;
|
|
|
|
std::stringstream rtn_name;
|
|
|
|