|
|
|
@ -1,11 +1,7 @@
|
|
|
|
|
#include <vmprofiler.hpp>
|
|
|
|
|
|
|
|
|
|
namespace vm
|
|
|
|
|
namespace vm::handler::profile
|
|
|
|
|
{
|
|
|
|
|
namespace handler
|
|
|
|
|
{
|
|
|
|
|
namespace profile
|
|
|
|
|
{
|
|
|
|
|
vm::handler::profile_t lconstq = {
|
|
|
|
|
// MOV RAX, [RSI]
|
|
|
|
|
// SUB RBP, 8
|
|
|
|
@ -23,8 +19,7 @@ namespace vm
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], RAX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_RAX;
|
|
|
|
@ -46,8 +41,7 @@ namespace vm
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], EAX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_EAX;
|
|
|
|
@ -69,8 +63,7 @@ namespace vm
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], AX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_AX;
|
|
|
|
@ -93,8 +86,7 @@ namespace vm
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], AX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_AX;
|
|
|
|
@ -119,8 +111,7 @@ namespace vm
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], EAX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_EAX;
|
|
|
|
@ -146,8 +137,7 @@ namespace vm
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], RAX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_RAX;
|
|
|
|
@ -165,16 +155,13 @@ namespace vm
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool { return instr.mnemonic == ZYDIS_MNEMONIC_CDQE; },
|
|
|
|
|
// SUB RBP, 8
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_SUB &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_SUB && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 0 ].reg.value == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_IMMEDIATE &&
|
|
|
|
|
instr.operands[ 1 ].imm.value.u == 0x8;
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_IMMEDIATE && instr.operands[ 1 ].imm.value.u == 0x8;
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], RAX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_RAX;
|
|
|
|
@ -200,8 +187,7 @@ namespace vm
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], RAX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_RAX;
|
|
|
|
@ -227,13 +213,10 @@ namespace vm
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], EAX
|
|
|
|
|
[]( const zydis_decoded_instr_t &instr ) -> bool {
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
|
|
|
|
instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
|
|
|
|
instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[ 1 ].reg.value == ZYDIS_REGISTER_EAX;
|
|
|
|
|
} } },
|
|
|
|
|
vm::handler::extention_t::sign_extend };
|
|
|
|
|
} // namespace profile
|
|
|
|
|
} // namespace handler
|
|
|
|
|
} // namespace vm
|
|
|
|
|
} // namespace vm::handler::profile
|