|
|
|
#include <vm_lifters.hpp>
|
|
|
|
|
|
|
|
namespace vmp2::lifters
|
|
|
|
{
|
|
|
|
lifter_callback_t addq = [ & ]( vm::vmp_rtn_t *rtn, const vm::instrs::code_block_t &vm_code_block,
|
|
|
|
const vm::instrs::virt_instr_t &vinstr, llvm::IRBuilder<> *ir_builder ) {
|
|
|
|
auto t1 = rtn->pop( 8 );
|
|
|
|
auto t2 = rtn->pop( 8 );
|
|
|
|
auto t3 = ir_builder->CreateAdd( t1, t2 );
|
|
|
|
rtn->push( 8, t3 );
|
|
|
|
|
|
|
|
// TODO: compute and update RFLAGS...
|
|
|
|
// do the updating here on rtn->flags before we push it...
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
rtn->push( 8, rtn->load_value( 8, rtn->flags ) );
|
|
|
|
};
|
|
|
|
|
|
|
|
lifter_callback_t adddw = [ & ]( vm::vmp_rtn_t *rtn, const vm::instrs::code_block_t &vm_code_block,
|
|
|
|
const vm::instrs::virt_instr_t &vinstr, llvm::IRBuilder<> *ir_builder ) {
|
|
|
|
auto t1 = rtn->pop( 4 );
|
|
|
|
auto t2 = rtn->pop( 4 );
|
|
|
|
auto t3 = ir_builder->CreateAdd( t1, t2 );
|
|
|
|
rtn->push( 4, t3 );
|
|
|
|
|
|
|
|
// TODO: compute and update RFLAGS...
|
|
|
|
// do the updating here on rtn->flags before we push it...
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
rtn->push( 8, rtn->load_value( 8, rtn->flags ) );
|
|
|
|
};
|
|
|
|
|
|
|
|
lifter_callback_t addw = [ & ]( vm::vmp_rtn_t *rtn, const vm::instrs::code_block_t &vm_code_block,
|
|
|
|
const vm::instrs::virt_instr_t &vinstr, llvm::IRBuilder<> *ir_builder ) {
|
|
|
|
auto t1 = rtn->pop( 2 );
|
|
|
|
auto t2 = rtn->pop( 2 );
|
|
|
|
auto t3 = ir_builder->CreateAdd( t1, t2 );
|
|
|
|
rtn->push( 2, t3 );
|
|
|
|
|
|
|
|
// TODO: compute and update RFLAGS...
|
|
|
|
// do the updating here on rtn->flags before we push it...
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
rtn->push( 8, rtn->load_value( 8, rtn->flags ) );
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace vmp2::lifters
|