#pragma once #include namespace vm { namespace handler { enum mnemonic_t { INVALID, LRFLAGS, PUSHVSP, MULQ, DIVQ, CALL, JMP, VMEXIT, SREGQ, SREGDW, SREGW, LREGQ, LREGDW, LCONSTQ, LCONSTBZXW, LCONSTBSXQ, LCONSTBSXDW, LCONSTDWSXQ, LCONSTWSXQ, LCONSTWSXDW, LCONSTDW, LCONSTW, READQ, READDW, READW, WRITEQ, WRITEDW, WRITEW, WRITEB, ADDQ, ADDDW, ADDW, SHLQ, SHLDW, SHRQ, SHRW, NANDQ, NANDDW, NANDW }; using zydis_callback_t = std::function; enum extention_t { none, sign_extend, zero_extend }; struct profile_t { const char *name; mnemonic_t mnemonic; u8 imm_size; std::vector< zydis_callback_t > signature; extention_t extention; }; namespace profile { extern vm::handler::profile_t sregq; extern vm::handler::profile_t sregdw; extern vm::handler::profile_t sregw; extern vm::handler::profile_t lregq; extern vm::handler::profile_t lregdw; extern vm::handler::profile_t lconstq; extern vm::handler::profile_t lconstdw; extern vm::handler::profile_t lconstw; extern vm::handler::profile_t lconstbzxw; extern vm::handler::profile_t lconstbsxdw; extern vm::handler::profile_t lconstbsxq; extern vm::handler::profile_t lconstdwsxq; extern vm::handler::profile_t lconstwsxq; extern vm::handler::profile_t lconstwsxdw; extern vm::handler::profile_t addq; extern vm::handler::profile_t adddw; extern vm::handler::profile_t addw; extern vm::handler::profile_t shlq; extern vm::handler::profile_t shldw; extern vm::handler::profile_t nandq; extern vm::handler::profile_t nanddw; extern vm::handler::profile_t nandw; extern vm::handler::profile_t writeq; extern vm::handler::profile_t writedw; extern vm::handler::profile_t writeb; extern vm::handler::profile_t readq; extern vm::handler::profile_t readdw; extern vm::handler::profile_t shrq; extern vm::handler::profile_t shrw; extern vm::handler::profile_t lrflags; extern vm::handler::profile_t call; extern vm::handler::profile_t pushvsp; extern vm::handler::profile_t mulq; extern vm::handler::profile_t divq; extern vm::handler::profile_t jmp; extern vm::handler::profile_t vmexit; inline std::vector< vm::handler::profile_t * > all = { &sregq, &sregdw, &sregw, &lregq, &lregdw, &lconstq, &lconstbzxw, &lconstbsxdw, &lconstbsxq, &lconstdwsxq, &lconstwsxq, &lconstwsxdw, &lconstdw, &lconstw, &addq, &adddw, &addw, &shlq, &shldw, &writeq, &writedw, &writeb, &nandq, &nanddw, &nandw, &shrq, &shrw, &readq, &readdw, &mulq, &pushvsp, &divq, &jmp, &lrflags, &vmexit, &call }; } // namespace profile } // namespace handler } // namespace vm