mirror of https://github.com/x64dbg/zydis
Fixed encoder header
This commit is contained in:
parent
57059d4e0d
commit
6bd79283e0
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||||
include(GenerateExportHeader)
|
include(GenerateExportHeader)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
@ -9,6 +9,12 @@ project(Zydis VERSION 2.0)
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
option(ZYDIS_FEATURE_DECODER
|
||||||
|
"Enable instruction decoding and formtting functionality"
|
||||||
|
ON)
|
||||||
|
option(ZYDIS_FEATURE_ENCODER
|
||||||
|
"Enable instruction encoding functionality"
|
||||||
|
OFF)
|
||||||
option(ZYDIS_FEATURE_EVEX
|
option(ZYDIS_FEATURE_EVEX
|
||||||
"Enable support for EVEX instructions"
|
"Enable support for EVEX instructions"
|
||||||
ON)
|
ON)
|
||||||
|
@ -21,12 +27,6 @@ option(ZYDIS_FEATURE_FLAGS
|
||||||
option(ZYDIS_FEATURE_CPUID
|
option(ZYDIS_FEATURE_CPUID
|
||||||
"Include information about CPUID feature-flags"
|
"Include information about CPUID feature-flags"
|
||||||
OFF)
|
OFF)
|
||||||
option(ZYDIS_FEATURE_DECODER
|
|
||||||
"Enable instruction decoding and formtting functionality"
|
|
||||||
ON)
|
|
||||||
option(ZYDIS_FEATURE_ENCODER
|
|
||||||
"Enable instruction encoding functionality"
|
|
||||||
OFF)
|
|
||||||
|
|
||||||
# Build configuration
|
# Build configuration
|
||||||
option(ZYDIS_BUILD_EXAMPLES
|
option(ZYDIS_BUILD_EXAMPLES
|
||||||
|
@ -69,6 +69,14 @@ target_include_directories("Zydis"
|
||||||
target_compile_definitions("Zydis" PRIVATE "_CRT_SECURE_NO_WARNINGS" "ZYDIS_EXPORTS")
|
target_compile_definitions("Zydis" PRIVATE "_CRT_SECURE_NO_WARNINGS" "ZYDIS_EXPORTS")
|
||||||
generate_export_header("Zydis" BASE_NAME "ZYDIS" EXPORT_FILE_NAME "ZydisExportConfig.h")
|
generate_export_header("Zydis" BASE_NAME "ZYDIS" EXPORT_FILE_NAME "ZydisExportConfig.h")
|
||||||
|
|
||||||
|
if (NOT ZYDIS_FEATURE_ENCODER AND NOT ZYDIS_FEATURE_DECODER)
|
||||||
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"\nIt's dangerous to go alone! Take at least one of these:\n"
|
||||||
|
"[ ] ZYDIS_FEATURE_ENCODER [ ] ZYDIS_FEATURE_DECODER"
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (ZYDIS_FEATURE_EVEX)
|
if (ZYDIS_FEATURE_EVEX)
|
||||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_EVEX")
|
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_EVEX")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -28,9 +28,11 @@
|
||||||
#define ZYDIS_ENCODER_H
|
#define ZYDIS_ENCODER_H
|
||||||
|
|
||||||
#include <Zydis/Defines.h>
|
#include <Zydis/Defines.h>
|
||||||
#include <Zydis/Types.h>
|
|
||||||
#include <Zydis/Status.h>
|
#include <Zydis/Status.h>
|
||||||
|
#include <Zydis/SharedTypes.h>
|
||||||
|
#ifdef ZYDIS_ENABLE_FEATURE_DECODER
|
||||||
# include <Zydis/DecoderTypes.h>
|
# include <Zydis/DecoderTypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -88,11 +90,11 @@ typedef struct ZydisEncoderOperand_
|
||||||
typedef struct ZydisEncoderRequest_
|
typedef struct ZydisEncoderRequest_
|
||||||
{
|
{
|
||||||
ZydisMachineMode machineMode;
|
ZydisMachineMode machineMode;
|
||||||
ZydisInstructionMnemonic mnemonic;
|
ZydisMnemonic mnemonic;
|
||||||
ZydisInstructionAttributes attributes;
|
ZydisInstructionAttributes attributes;
|
||||||
ZydisInstructionEncoding encoding;
|
ZydisInstructionEncoding encoding;
|
||||||
uint8_t operandCount;
|
uint8_t operandCount;
|
||||||
ZydisEncoderOperand operands[10];
|
ZydisEncoderOperand operands[5];
|
||||||
|
|
||||||
// TODO: AVX stuff
|
// TODO: AVX stuff
|
||||||
// TODO: MVEX stuff
|
// TODO: MVEX stuff
|
||||||
|
@ -102,8 +104,10 @@ typedef struct ZydisEncoderRequest_
|
||||||
/* Exported functions */
|
/* Exported functions */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
ZYDIS_EXPORT ZydisStatus ZydisEncoderRequestFromDecodedInstruction(
|
#ifdef ZYDIS_ENABLE_FEATURE_DECODER
|
||||||
|
ZYDIS_EXPORT ZydisStatus ZydisEncoderDecodedInstructionToRequest(
|
||||||
const ZydisDecodedInstruction* in, ZydisEncoderRequest* out);
|
const ZydisDecodedInstruction* in, ZydisEncoderRequest* out);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Encodes the given instruction info to byte-code.
|
* @brief Encodes the given instruction info to byte-code.
|
||||||
|
|
|
@ -73,7 +73,7 @@ typedef struct ZydisEncodableInstruction_
|
||||||
uint8_t evexB ZYDIS_BITFIELD( 2);
|
uint8_t evexB ZYDIS_BITFIELD( 2);
|
||||||
uint8_t evexZ ZYDIS_BITFIELD( 2);
|
uint8_t evexZ ZYDIS_BITFIELD( 2);
|
||||||
uint8_t mvexE ZYDIS_BITFIELD( 2);
|
uint8_t mvexE ZYDIS_BITFIELD( 2);
|
||||||
} filterIndizes;
|
} filters;
|
||||||
} ZydisEncodableInstruction;
|
} ZydisEncodableInstruction;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
Loading…
Reference in New Issue