parent
9806a1a1a3
commit
08d530b85c
@ -0,0 +1,43 @@
|
||||
# This file is automatically generated from cmake.toml - DO NOT EDIT
|
||||
# See https://github.com/build-cpp/cmkr for more information
|
||||
|
||||
# Create a configure-time dependency on cmake.toml to improve IDE support
|
||||
if(CMKR_ROOT_PROJECT)
|
||||
configure_file(cmake.toml cmake.toml COPYONLY)
|
||||
endif()
|
||||
|
||||
# Options
|
||||
option(ZYDIS_BUILD_SHARED_LIB OFF)
|
||||
option(ZYDIS_BUILD_EXAMPLES OFF)
|
||||
option(ZYDIS_BUILD_TOOLS OFF)
|
||||
option(ZYDIS_FUZZ_AFL_FAST OFF)
|
||||
option(ZYDIS_LIBFUZZER OFF)
|
||||
|
||||
# zydis
|
||||
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
|
||||
if(CMAKE_FOLDER)
|
||||
set(CMAKE_FOLDER "${CMAKE_FOLDER}/zydis")
|
||||
else()
|
||||
set(CMAKE_FOLDER zydis)
|
||||
endif()
|
||||
add_subdirectory(zydis)
|
||||
set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER})
|
||||
|
||||
# Target linux-pe
|
||||
set(CMKR_TARGET linux-pe)
|
||||
set(linux-pe_SOURCES "")
|
||||
|
||||
set(CMKR_SOURCES ${linux-pe_SOURCES})
|
||||
add_library(linux-pe INTERFACE)
|
||||
|
||||
if(linux-pe_SOURCES)
|
||||
target_sources(linux-pe INTERFACE ${linux-pe_SOURCES})
|
||||
endif()
|
||||
|
||||
target_include_directories(linux-pe INTERFACE
|
||||
"linux-pe/includes/"
|
||||
)
|
||||
|
||||
unset(CMKR_TARGET)
|
||||
unset(CMKR_SOURCES)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4756724a505d5514eed1f2351336e4d77bfb406f
|
||||
Subproject commit ce4a42ffaffe4a5ff615665e05177c4c69eb4683
|
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include <Zydis/Zydis.h>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
using u8 = unsigned char;
|
||||
using u16 = unsigned short;
|
||||
using u32 = unsigned int;
|
||||
using u64 = unsigned long long;
|
||||
|
||||
using zydis_decoded_instr_t = ZydisDecodedInstruction;
|
||||
using zydis_register_t = ZydisRegister;
|
||||
using zydis_mnemonic_t = ZydisMnemonic;
|
||||
using zydis_decoded_operand_t = ZydisDecodedOperand;
|
||||
|
||||
struct zydis_instr_t {
|
||||
zydis_decoded_instr_t instr;
|
||||
std::vector<u8> raw;
|
||||
std::uintptr_t addr;
|
||||
};
|
||||
|
||||
using zydis_routine_t = std::vector<zydis_instr_t>;
|
||||
|
||||
namespace vm::utils {
|
||||
inline thread_local std::shared_ptr<ZydisDecoder> g_decoder = nullptr;
|
||||
inline thread_local std::shared_ptr<ZydisFormatter> g_formatter = nullptr;
|
||||
|
||||
inline void init() {
|
||||
if (!vm::utils::g_decoder && !vm::utils::g_formatter) {
|
||||
vm::utils::g_decoder = std::make_shared<ZydisDecoder>();
|
||||
vm::utils::g_formatter = std::make_shared<ZydisFormatter>();
|
||||
|
||||
ZydisDecoderInit(vm::utils::g_decoder.get(), ZYDIS_MACHINE_MODE_LONG_64,
|
||||
ZYDIS_ADDRESS_WIDTH_64);
|
||||
|
||||
ZydisFormatterInit(vm::utils::g_formatter.get(),
|
||||
ZYDIS_FORMATTER_STYLE_INTEL);
|
||||
}
|
||||
}
|
||||
} // namespace vm::utils
|
Loading…
Reference in new issue