@ -1 +1 @@
|
||||
Subproject commit 9b8764004a284fefe599c407f4ebbdf5a8aa4b0a
|
||||
Subproject commit 4f83eae434696201f5075d65b11bf8329c6d218a
|
@ -1 +1 @@
|
||||
Subproject commit 63a445cbba18bf1313ac3699b5d25462b5d529f4
|
||||
Subproject commit 6c1cbef6ac505d355033aef1176b684d02e1eb3a
|
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include <unicorn\unicorn.h>
|
||||
|
||||
extern int g_allocation_tracker;
|
||||
|
||||
uc_err uct_context_alloc(uc_engine *uc, uc_context **context);
|
||||
uc_err uct_context_free(uc_context *context);
|
||||
void print_allocation_number();
|
@ -0,0 +1,22 @@
|
||||
#include <uc_allocation_tracker.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
int g_allocation_tracker;
|
||||
|
||||
uc_err uct_context_alloc(uc_engine *uc, uc_context **context)
|
||||
{
|
||||
++g_allocation_tracker;
|
||||
//std::printf("Allocations: %p\n", g_allocation_tracker);
|
||||
return uc_context_alloc(uc, context);
|
||||
}
|
||||
uc_err uct_context_free(uc_context *context)
|
||||
{
|
||||
--g_allocation_tracker;
|
||||
//std::printf("Allocations: %p\n", g_allocation_tracker);
|
||||
return uc_context_free(context);
|
||||
}
|
||||
|
||||
void print_allocation_number()
|
||||
{
|
||||
std::printf("uc_context allocations: %p\n", g_allocation_tracker);
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
#include <vminstrs.hpp>
|
||||
|
||||
// Loads an address and value from the stack, ands the derefed address with the value
|
||||
namespace vm::instrs {
|
||||
profiler_t _and = {
|
||||
"AND",
|
||||
mnemonic_t::_and,
|
||||
{{// MOV REG, [VSP] This is the address
|
||||
LOAD_VALUE,
|
||||
// MOV REG, [VSP+8]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[1].mem.base == vsp &&
|
||||
instr.operands[1].mem.disp.has_displacement,
|
||||
instr.operands[1].mem.disp.value == 8;
|
||||
},
|
||||
// AND [REG], REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_AND &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base != ZYDIS_REGISTER_NONE &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
},
|
||||
// PUSHFQ
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_PUSHFQ;
|
||||
},
|
||||
// POP [VSP]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_POP &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp;
|
||||
}}},
|
||||
[](zydis_reg_t& vip, zydis_reg_t& vsp,
|
||||
hndlr_trace_t& hndlr) -> std::optional<vinstr_t> {
|
||||
vinstr_t res{mnemonic_t::_and};
|
||||
res.imm.has_imm = false;
|
||||
|
||||
// MOV REG [VSP+OFFSET]
|
||||
const auto mov_vsp_offset = std::find_if(
|
||||
hndlr.m_instrs.begin(), hndlr.m_instrs.end(),
|
||||
[&](emu_instr_t& instr) -> bool {
|
||||
const auto& i = instr.m_instr;
|
||||
return
|
||||
i.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
i.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
i.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
i.operands[1].mem.base == vsp &&
|
||||
i.operands[1].mem.disp.has_displacement;
|
||||
});
|
||||
if (mov_vsp_offset == hndlr.m_instrs.end())
|
||||
return std::nullopt;
|
||||
|
||||
res.stack_size = mov_vsp_offset->m_instr.operands[0].size;
|
||||
return res;
|
||||
}};
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
#include <vminstrs.hpp>
|
||||
|
||||
//Loads CR0 onto the stack
|
||||
namespace vm::instrs {
|
||||
profiler_t lcr0 = {
|
||||
"LCR0",
|
||||
mnemonic_t::lcr0,
|
||||
{
|
||||
// MOV REG, CR0
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].reg.value == ZYDIS_REGISTER_CR0;
|
||||
},
|
||||
// SUB VSP, OFFSET
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_SUB &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[0].reg.value == vsp &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE;
|
||||
},
|
||||
// MOV [VSP], REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp &&
|
||||
instr.operands[0].mem.index == ZYDIS_REGISTER_NONE &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].reg.value != vsp;
|
||||
}
|
||||
},
|
||||
[](zydis_reg_t& vip, zydis_reg_t& vsp,
|
||||
hndlr_trace_t& hndlr) -> std::optional<vinstr_t> {
|
||||
vinstr_t res{mnemonic_t::lcr0};
|
||||
res.imm.has_imm = false;
|
||||
res.stack_size = 64;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
#include <vminstrs.hpp>
|
||||
|
||||
namespace vm::instrs {
|
||||
profiler_t _or = {
|
||||
"OR",
|
||||
mnemonic_t::_or,
|
||||
{{// MOV REG, [VSP]
|
||||
LOAD_VALUE,
|
||||
// MOV REG, [VSP+OFFSET]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[1].mem.base == vsp &&
|
||||
instr.operands[1].mem.disp.has_displacement;
|
||||
},
|
||||
// OR [REG], REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_OR &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base != ZYDIS_REGISTER_NONE &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
},
|
||||
// PUSHFQ
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_PUSHFQ;
|
||||
},
|
||||
// POP [VSP]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_POP &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp;
|
||||
}}},
|
||||
[](zydis_reg_t& vip, zydis_reg_t& vsp,
|
||||
hndlr_trace_t& hndlr) -> std::optional<vinstr_t> {
|
||||
vinstr_t res{mnemonic_t::_or};
|
||||
res.imm.has_imm = false;
|
||||
|
||||
// MOV REG [VSP+OFFSET]
|
||||
const auto reg_vsp_offset = std::find_if(
|
||||
hndlr.m_instrs.begin(), hndlr.m_instrs.end(),
|
||||
[&](emu_instr_t& instr) -> bool {
|
||||
const auto& i = instr.m_instr;
|
||||
return
|
||||
i.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
i.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
i.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
i.operands[1].mem.base == vsp &&
|
||||
i.operands[1].mem.disp.has_displacement;
|
||||
});
|
||||
if (reg_vsp_offset == hndlr.m_instrs.end())
|
||||
return std::nullopt;
|
||||
res.stack_size = reg_vsp_offset->m_instr.operands[0].size;
|
||||
return res;
|
||||
}};
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
#include <vminstrs.hpp>
|
||||
|
||||
namespace vm::instrs {
|
||||
profiler_t shl = {
|
||||
"SHL",
|
||||
mnemonic_t::shl,
|
||||
{{// MOV REG, [VSP]
|
||||
LOAD_VALUE,
|
||||
// MOV REG, [VSP+OFFSET]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[1].mem.base == vsp &&
|
||||
instr.operands[1].mem.disp.has_displacement;
|
||||
},
|
||||
// SHL REG, REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_SHL &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
},
|
||||
// MOV [VSP+OFFSET], REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp &&
|
||||
instr.operands[0].mem.disp.has_displacement &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
},
|
||||
// PUSHFQ
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_PUSHFQ;
|
||||
},
|
||||
// POP [VSP]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_POP &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp;
|
||||
}}},
|
||||
[](zydis_reg_t& vip, zydis_reg_t& vsp,
|
||||
hndlr_trace_t& hndlr) -> std::optional<vinstr_t> {
|
||||
vinstr_t res{mnemonic_t::shl};
|
||||
res.imm.has_imm = false;
|
||||
|
||||
const auto shl_reg = std::find_if(
|
||||
hndlr.m_instrs.begin(), hndlr.m_instrs.end(),
|
||||
[&](emu_instr_t& instr) -> bool {
|
||||
const auto& i = instr.m_instr;
|
||||
return i.mnemonic == ZYDIS_MNEMONIC_SHL &&
|
||||
i.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
i.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
});
|
||||
|
||||
res.stack_size = shl_reg->m_instr.operands[0].size;
|
||||
return res;
|
||||
}};
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
#include <vminstrs.hpp>
|
||||
|
||||
namespace vm::instrs {
|
||||
profiler_t shld = {
|
||||
"SHLD",
|
||||
mnemonic_t::shld,
|
||||
{{// MOV REG, [VSP]
|
||||
LOAD_VALUE,
|
||||
// MOV REG, [VSP+OFFSET]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[1].mem.base == vsp &&
|
||||
instr.operands[1].mem.disp.has_displacement;
|
||||
},
|
||||
// MOV REG, [VSP+OFFSET]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[1].mem.base == vsp &&
|
||||
instr.operands[1].mem.disp.has_displacement;
|
||||
},
|
||||
// SHLD REG, REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_SHLD &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
},
|
||||
// MOV [VSP+OFFSET], REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp &&
|
||||
instr.operands[0].mem.disp.has_displacement &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
},
|
||||
// PUSHFQ
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_PUSHFQ;
|
||||
},
|
||||
// POP [VSP]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_POP &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp;
|
||||
}}},
|
||||
[](zydis_reg_t& vip, zydis_reg_t& vsp,
|
||||
hndlr_trace_t& hndlr) -> std::optional<vinstr_t> {
|
||||
vinstr_t res{mnemonic_t::shld};
|
||||
res.imm.has_imm = false;
|
||||
|
||||
const auto shld_reg = std::find_if(
|
||||
hndlr.m_instrs.begin(), hndlr.m_instrs.end(),
|
||||
[&](emu_instr_t& instr) -> bool {
|
||||
const auto& i = instr.m_instr;
|
||||
return i.mnemonic == ZYDIS_MNEMONIC_SHLD &&
|
||||
i.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
i.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
});
|
||||
|
||||
res.stack_size = shld_reg->m_instr.operands[0].size;
|
||||
return res;
|
||||
}};
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
#include <vminstrs.hpp>
|
||||
|
||||
namespace vm::instrs {
|
||||
profiler_t shrd = {
|
||||
"SHRD",
|
||||
mnemonic_t::shrd,
|
||||
{{// MOV REG, [VSP]
|
||||
LOAD_VALUE,
|
||||
// MOV REG, [VSP+OFFSET]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[1].mem.base == vsp &&
|
||||
instr.operands[1].mem.disp.has_displacement;
|
||||
},
|
||||
// MOV REG, [VSP+OFFSET]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[1].mem.base == vsp &&
|
||||
instr.operands[1].mem.disp.has_displacement;
|
||||
},
|
||||
// SHRD REG, REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_SHRD &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
},
|
||||
// MOV [VSP+OFFSET], REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp &&
|
||||
instr.operands[0].mem.disp.has_displacement &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
},
|
||||
// PUSHFQ
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_PUSHFQ;
|
||||
},
|
||||
// POP [VSP]
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_POP &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||||
instr.operands[0].mem.base == vsp;
|
||||
}}},
|
||||
[](zydis_reg_t& vip, zydis_reg_t& vsp,
|
||||
hndlr_trace_t& hndlr) -> std::optional<vinstr_t> {
|
||||
vinstr_t res{mnemonic_t::shrd};
|
||||
res.imm.has_imm = false;
|
||||
|
||||
const auto shrd_reg = std::find_if(
|
||||
hndlr.m_instrs.begin(), hndlr.m_instrs.end(),
|
||||
[&](emu_instr_t& instr) -> bool {
|
||||
const auto& i = instr.m_instr;
|
||||
return i.mnemonic == ZYDIS_MNEMONIC_SHRD &&
|
||||
i.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
i.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER;
|
||||
});
|
||||
|
||||
res.stack_size = shrd_reg->m_instr.operands[0].size;
|
||||
return res;
|
||||
}};
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
#include <vminstrs.hpp>
|
||||
|
||||
//Write value on top of stack to dr7
|
||||
namespace vm::instrs {
|
||||
profiler_t writedr7 = {
|
||||
"WRITEDR7",
|
||||
mnemonic_t::writedr7,
|
||||
{
|
||||
// MOV REG, [VSP+OFFSET]
|
||||
LOAD_VALUE,
|
||||
// ADD VSP, OFFSET
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_ADD &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[0].reg.value == vsp &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE;
|
||||
},
|
||||
// MOV DR7, REG
|
||||
[](const zydis_reg_t vip, const zydis_reg_t vsp,
|
||||
const zydis_decoded_instr_t& instr) -> bool {
|
||||
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[0].reg.value == ZYDIS_REGISTER_DR7 &&
|
||||
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
instr.operands[1].reg.value != vsp;
|
||||
}
|
||||
},
|
||||
[](zydis_reg_t& vip, zydis_reg_t& vsp,
|
||||
hndlr_trace_t& hndlr) -> std::optional<vinstr_t> {
|
||||
vinstr_t res{mnemonic_t::writedr7};
|
||||
res.stack_size == 64;
|
||||
res.imm.has_imm = false;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in new issue