Merge branch 'develop' of github.com:zyantific/zyan-disassembler-engine into develop

This commit is contained in:
flobernd 2016-11-28 19:58:01 +01:00
commit fbbbcbadb8
7 changed files with 19 additions and 36 deletions

View File

@ -61,7 +61,7 @@ enum ZydisFormatterStyles
/** /**
* @brief Defines the @c ZydisFormatFlags datatype. * @brief Defines the @c ZydisFormatFlags datatype.
*/ */
typedef uint32_t ZydisFormatFlags; typedef uint32_t ZydisFormatterFlags;
/** /**
* @brief Formats the instruction in uppercase instead of lowercase. * @brief Formats the instruction in uppercase instead of lowercase.
@ -376,9 +376,9 @@ typedef ZydisStatus (*ZydisFormatterFormatAddressFunc)(ZydisInstructionFormatter
/** /**
* @brief Defines the @c ZydisInstructionFormatter struct. * @brief Defines the @c ZydisInstructionFormatter struct.
*/ */
typedef struct ZydisInstructionFormatter_ struct ZydisInstructionFormatter_
{ {
ZydisFormatFlags flags; ZydisFormatterFlags flags;
ZydisFormatterAddressFormat addressFormat; ZydisFormatterAddressFormat addressFormat;
ZydisFormatterDisplacementFormat displacementFormat; ZydisFormatterDisplacementFormat displacementFormat;
ZydisFormatterImmediateFormat immediateFormat; ZydisFormatterImmediateFormat immediateFormat;
@ -402,7 +402,7 @@ typedef struct ZydisInstructionFormatter_
const char* delimMnemonic; const char* delimMnemonic;
const char* delimOperands; const char* delimOperands;
const char* fmtDecorator; // TODO: const char* fmtDecorator; // TODO:
} ZydisInstructionFormatter; };
/* ============================================================================================== */ /* ============================================================================================== */
/* Exported functions */ /* Exported functions */
@ -431,7 +431,7 @@ ZYDIS_EXPORT ZydisStatus ZydisFormatterInitInstructionFormatter(
* @return A zydis status code. * @return A zydis status code.
*/ */
ZYDIS_EXPORT ZydisStatus ZydisFormatterInitInstructionFormatterEx( ZYDIS_EXPORT ZydisStatus ZydisFormatterInitInstructionFormatterEx(
ZydisInstructionFormatter* formatter, ZydisFormatterStyle style, ZydisFormatFlags flags, ZydisInstructionFormatter* formatter, ZydisFormatterStyle style, ZydisFormatterFlags flags,
ZydisFormatterAddressFormat addressFormat, ZydisFormatterDisplacementFormat displacementFormat, ZydisFormatterAddressFormat addressFormat, ZydisFormatterDisplacementFormat displacementFormat,
ZydisFormatterImmediateFormat immmediateFormat); ZydisFormatterImmediateFormat immmediateFormat);

View File

@ -65,13 +65,13 @@ typedef bool (*ZydisInputNextFunc)(ZydisCustomInput* input, uint8_t* data);
/** /**
* @brief Defines the zydis custom input struct. * @brief Defines the zydis custom input struct.
*/ */
typedef struct ZydisCustomInput_ struct ZydisCustomInput_
{ {
/** /**
* @brief The @c ZydisInputNextFunc callback. * @brief The @c ZydisInputNextFunc callback.
*/ */
ZydisInputNextFunc inputNext; ZydisInputNextFunc inputNext;
} ZydisCustomInput; };
/* ---------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------- */

View File

@ -17,7 +17,7 @@ typedef struct ZydisInstructionDefinition_
#endif #endif
#ifdef ZYDIS_ENABLE_FEATURE_AFFECTED_FLAGS #ifdef ZYDIS_ENABLE_FEATURE_AFFECTED_FLAGS
uint8_t affectedFlagsId : 8; uint8_t affectedFlagsId : 8;
#endif; #endif
#ifdef ZYDIS_ENABLE_FEATURE_CPUID #ifdef ZYDIS_ENABLE_FEATURE_CPUID
uint8_t cpuidId : 8; uint8_t cpuidId : 8;
#endif #endif

View File

@ -2142,28 +2142,6 @@ static ZydisDecoderStatus ZydisNodeHandlerEvexB(ZydisInstructionInfo* info, uint
return ZYDIS_STATUS_DECODER_SUCCESS; return ZYDIS_STATUS_DECODER_SUCCESS;
} }
static ZydisDecoderStatus ZydisNodeHandlerEvexK(ZydisInstructionInfo* info, uint16_t* index)
{
ZYDIS_ASSERT(info);
ZYDIS_ASSERT(index);
ZYDIS_ASSERT(info->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX);
ZYDIS_ASSERT(info->details.evex.isDecoded);
*index = (info->details.evex.aaa == 0) ? 0 : 1;
return ZYDIS_STATUS_DECODER_SUCCESS;
}
static ZydisDecoderStatus ZydisNodeHandlerEvexZ(ZydisInstructionInfo* info, uint16_t* index)
{
ZYDIS_ASSERT(info);
ZYDIS_ASSERT(index);
ZYDIS_ASSERT(info->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX);
ZYDIS_ASSERT(info->details.evex.isDecoded);
*index = info->details.evex.z;
return ZYDIS_STATUS_DECODER_SUCCESS;
}
/** /**
* @brief Uses the instruction-table to decode the bytestream until an instruction-definition * @brief Uses the instruction-table to decode the bytestream until an instruction-definition
* is found. * is found.

View File

@ -816,7 +816,7 @@ ZydisStatus ZydisFormatterInitInstructionFormatter(
} }
ZydisStatus ZydisFormatterInitInstructionFormatterEx( ZydisStatus ZydisFormatterInitInstructionFormatterEx(
ZydisInstructionFormatter* formatter, ZydisFormatterStyle style, ZydisFormatFlags flags, ZydisInstructionFormatter* formatter, ZydisFormatterStyle style, ZydisFormatterFlags flags,
ZydisFormatterAddressFormat addressFormat, ZydisFormatterDisplacementFormat displacementFormat, ZydisFormatterAddressFormat addressFormat, ZydisFormatterDisplacementFormat displacementFormat,
ZydisFormatterImmediateFormat immmediateFormat) ZydisFormatterImmediateFormat immmediateFormat)
{ {

View File

@ -60,7 +60,8 @@ int main(int argc, char** argv)
ZydisInstructionFormatter formatter; ZydisInstructionFormatter formatter;
if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter, if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter,
ZYDIS_FORMATTER_STYLE_INTEL, ZYDIS_FORMATTER_FLAG_ALWAYS_DISPLAY_MEMORY_SEGMENT))) ZYDIS_FORMATTER_STYLE_INTEL, ZYDIS_FMTFLAG_FORCE_SEGMENTS | ZYDIS_FMTFLAG_FORCE_OPERANDSIZE,
ZYDIS_FORMATTER_ADDR_ABSOLUTE, ZYDIS_FORMATTER_DISP_DEFAULT, ZYDIS_FORMATTER_IMM_DEFAULT)))
{ {
fputs("Failed to initialized instruction-formatter\n", stderr); fputs("Failed to initialized instruction-formatter\n", stderr);
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -44,6 +44,9 @@ typedef struct ZydisFuzzControlBlock_ {
ZydisDecoderFlags decoderFlags; ZydisDecoderFlags decoderFlags;
ZydisFormatterStyle formatterStyle; ZydisFormatterStyle formatterStyle;
ZydisFormatterFlags formatterFlags; ZydisFormatterFlags formatterFlags;
ZydisFormatterAddressFormat formatterAddrFormat;
ZydisFormatterDisplacementFormat formatterDispFormat;
ZydisFormatterImmediateFormat formatterImmFormat;
uint8_t bufSize; uint8_t bufSize;
} ZydisFuzzControlBlock; } ZydisFuzzControlBlock;
@ -69,7 +72,8 @@ int main()
ZydisInstructionFormatter formatter; ZydisInstructionFormatter formatter;
if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter, if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter,
controlBlock.formatterStyle, controlBlock.formatterFlags))) controlBlock.formatterStyle, controlBlock.formatterFlags, controlBlock.formatterAddrFormat,
controlBlock.formatterDispFormat, controlBlock.formatterImmFormat)))
{ {
fputs("failed to initialized instruction-formatter\n", stderr); fputs("failed to initialized instruction-formatter\n", stderr);
return EXIT_FAILURE; return EXIT_FAILURE;