renamed LVSP to POPVSP, updated the DSE algo to skip CALL instructions

merge-requests/16/merge
_xeroxz 3 years ago
parent ef9e9c1cb2
commit 16aeb2d6d4

@ -52,9 +52,9 @@ list(APPEND vmprofiler_SOURCES
"src/vmprofiles/lconst.cpp" "src/vmprofiles/lconst.cpp"
"src/vmprofiles/lflags.cpp" "src/vmprofiles/lflags.cpp"
"src/vmprofiles/lreg.cpp" "src/vmprofiles/lreg.cpp"
"src/vmprofiles/lvsp.cpp"
"src/vmprofiles/mul.cpp" "src/vmprofiles/mul.cpp"
"src/vmprofiles/nand.cpp" "src/vmprofiles/nand.cpp"
"src/vmprofiles/popvsp.cpp"
"src/vmprofiles/pushvsp.cpp" "src/vmprofiles/pushvsp.cpp"
"src/vmprofiles/read.cpp" "src/vmprofiles/read.cpp"
"src/vmprofiles/shl.cpp" "src/vmprofiles/shl.cpp"
@ -69,7 +69,6 @@ list(APPEND vmprofiler_SOURCES
"include/vmctx.hpp" "include/vmctx.hpp"
"include/vmhandlers.hpp" "include/vmhandlers.hpp"
"include/vminstrs.hpp" "include/vminstrs.hpp"
"include/vmlifters.hpp"
"include/vmlocate.hpp" "include/vmlocate.hpp"
"include/vmp2.hpp" "include/vmp2.hpp"
"include/vmprofiler.hpp" "include/vmprofiler.hpp"

@ -18,7 +18,7 @@ namespace vm::handler
CALL, CALL,
JMP, JMP,
VMEXIT, VMEXIT,
LVSP, POPVSP,
PUSHVSP, PUSHVSP,
PUSHVSPDW, PUSHVSPDW,
@ -146,7 +146,6 @@ namespace vm::handler
extern vm::handler::profile_t shlq; extern vm::handler::profile_t shlq;
extern vm::handler::profile_t shldw; extern vm::handler::profile_t shldw;
extern vm::handler::profile_t shlddw; extern vm::handler::profile_t shlddw;
extern vm::handler::profile_t nandq; extern vm::handler::profile_t nandq;
@ -175,7 +174,7 @@ namespace vm::handler
extern vm::handler::profile_t mulq; extern vm::handler::profile_t mulq;
extern vm::handler::profile_t divq; extern vm::handler::profile_t divq;
extern vm::handler::profile_t jmp; extern vm::handler::profile_t jmp;
extern vm::handler::profile_t lvsp; extern vm::handler::profile_t popvsp;
extern vm::handler::profile_t vmexit; extern vm::handler::profile_t vmexit;
/// <summary> /// <summary>
@ -184,7 +183,7 @@ namespace vm::handler
inline std::vector< vm::handler::profile_t * > all = { inline std::vector< vm::handler::profile_t * > all = {
&sregq, &sregdw, &sregw, &lregq, &lregdw, &lconstq, &lconstbzxw, &lconstbsxdw, &sregq, &sregdw, &sregw, &lregq, &lregdw, &lconstq, &lconstbzxw, &lconstbsxdw,
&lconstbsxq, &lconstdwsxq, &lconstwsxq, &lconstwsxdw, &lconstdw, &lconstw, &addq, &adddw, &lconstbsxq, &lconstdwsxq, &lconstwsxq, &lconstwsxdw, &lconstdw, &lconstw, &addq, &adddw,
&addw, &lvsp, &addw, &popvsp,
&shlq, &shldw, &writeq, &writedw, &writeb, &nandq, &nanddw, &nandw, &shlq, &shldw, &writeq, &writedw, &writeb, &nandq, &nanddw, &nandw,
&nandb, &nandb,

@ -2,10 +2,10 @@
namespace vm::handler::profile namespace vm::handler::profile
{ {
vm::handler::profile_t lvsp = { vm::handler::profile_t popvsp = {
// MOV RBP [RBP] // MOV RBP [RBP]
"LVSP", "POPVSP",
LVSP, POPVSP,
NULL, NULL,
{ { []( const zydis_decoded_instr_t &instr ) -> bool { { { []( const zydis_decoded_instr_t &instr ) -> bool {
return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER && return instr.mnemonic == ZYDIS_MNEMONIC_MOV && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER &&

@ -209,7 +209,8 @@ namespace vm::util
for ( auto itr = routine.begin(); itr != routine.end(); ++itr ) for ( auto itr = routine.begin(); itr != routine.end(); ++itr )
{ {
// dont remove these... at all... // dont remove these... at all...
if ( itr->instr.mnemonic == ZYDIS_MNEMONIC_PUSH || itr->instr.mnemonic == ZYDIS_MNEMONIC_POP ) if ( itr->instr.mnemonic == ZYDIS_MNEMONIC_PUSH || itr->instr.mnemonic == ZYDIS_MNEMONIC_POP ||
itr->instr.mnemonic == ZYDIS_MNEMONIC_CALL )
continue; continue;
// lol... we are only looking at linear code anyways... :P // lol... we are only looking at linear code anyways... :P

Loading…
Cancel
Save