From dd3aeabbb08a80ea279f8a380a597e09ff4a75bc Mon Sep 17 00:00:00 2001 From: xtremegamer1 Date: Fri, 14 Oct 2022 07:14:48 -0600 Subject: [PATCH] Added a function to determine if a register is 32-bit general purpose --- include/vmutils.hpp | 2 ++ src/vmutils.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/vmutils.hpp b/include/vmutils.hpp index 14af5ab..d66d7dc 100644 --- a/include/vmutils.hpp +++ b/include/vmutils.hpp @@ -70,6 +70,8 @@ inline bool open_binary_file(const std::string& file, /// bool is_jmp(const zydis_decoded_instr_t& instr); +bool is_32_bit_gp(const ZydisRegister reg); + /// /// used by profiles to see if an instruction is a MOV/SX/ZX... /// diff --git a/src/vmutils.cpp b/src/vmutils.cpp index 73e917c..f6b9ce3 100644 --- a/src/vmutils.cpp +++ b/src/vmutils.cpp @@ -28,6 +28,11 @@ bool is_mov(const zydis_decoded_instr_t& instr) { instr.mnemonic == ZYDIS_MNEMONIC_MOVZX; } +bool is_32_bit_gp(const ZydisRegister reg) +{ + return reg >= ZYDIS_REGISTER_EAX && reg <= ZYDIS_REGISTER_R15D; +} + bool flatten(zydis_rtn_t& routine, std::uintptr_t routine_addr, bool keep_jmps,