Performance optimizations

This commit is contained in:
flobernd 2017-06-27 03:32:42 +02:00
parent 920d62d699
commit e7a7be70e9
5 changed files with 123 additions and 101 deletions

View File

@ -112,7 +112,7 @@ ZYDIS_EXPORT ZydisStatus ZydisDecoderInitInstructionDecoderEx(ZydisInstructionDe
*
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisDecoderDecodeBuffer(ZydisInstructionDecoder* decoder,
ZYDIS_EXPORT ZydisStatus ZydisDecoderDecodeBuffer(const ZydisInstructionDecoder* decoder,
const void* buffer, size_t bufferLen, uint64_t instructionPointer, ZydisInstructionInfo* info);
/* ============================================================================================== */

View File

@ -291,7 +291,7 @@ typedef struct ZydisInstructionFormatter_ ZydisInstructionFormatter;
* This function type is used for the @c ZYDIS_FORMATTER_HOOK_PRE and
* @c ZYDIS_FORMATTER_HOOK_POST hook-types.
*/
typedef ZydisStatus (*ZydisFormatterNotifyFunc)(ZydisInstructionFormatter* formatter,
typedef ZydisStatus (*ZydisFormatterNotifyFunc)(const ZydisInstructionFormatter* formatter,
ZydisInstructionInfo* info);
/**
@ -311,7 +311,7 @@ typedef ZydisStatus (*ZydisFormatterNotifyFunc)(ZydisInstructionFormatter* forma
* This function type is used for the @c ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION,
* @c ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES and @c ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC hook-types.
*/
typedef ZydisStatus (*ZydisFormatterFormatFunc)(ZydisInstructionFormatter* formatter,
typedef ZydisStatus (*ZydisFormatterFormatFunc)(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info);
/**
@ -347,7 +347,7 @@ typedef ZydisStatus (*ZydisFormatterFormatFunc)(ZydisInstructionFormatter* forma
* @c ZYDIS_FORMATTER_HOOK_PRINT_DISPLACEMENT and @c ZYDIS_FORMATTER_HOOK_PRINT_IMMEDIATE
* hook-types.
*/
typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(ZydisInstructionFormatter* formatter,
typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand);
/**
@ -368,7 +368,7 @@ typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(ZydisInstructionFormatter
*
* This function type is used for the @c ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS hook-type.
*/
typedef ZydisStatus (*ZydisFormatterFormatAddressFunc)(ZydisInstructionFormatter* formatter,
typedef ZydisStatus (*ZydisFormatterFormatAddressFunc)(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand,
uint64_t address);
@ -456,9 +456,8 @@ ZYDIS_EXPORT ZydisStatus ZydisFormatterSetHook(ZydisInstructionFormatter* format
*
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction(
ZydisInstructionFormatter* formatter, ZydisInstructionInfo* info, char* buffer,
size_t bufferLen);
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction(const ZydisInstructionFormatter* formatter,
ZydisInstructionInfo* info, char* buffer, size_t bufferLen);
/* ============================================================================================== */

View File

@ -35,6 +35,8 @@
extern "C" {
#endif
#define ZYDIS_BITFIELD(x) : x
/* ============================================================================================== */
/* Enums and types */
/* ============================================================================================== */
@ -242,28 +244,28 @@ enum ZydisInternalElementTypes
*/
typedef struct ZydisOperandDefinition_
{
ZydisSemanticOperandType type : 5;
ZydisOperandVisibility visibility : 2;
ZydisOperandAction action : 3;
ZydisSemanticOperandType type ZYDIS_BITFIELD(5);
ZydisOperandVisibility visibility ZYDIS_BITFIELD(2);
ZydisOperandAction action ZYDIS_BITFIELD(3);
uint16_t size[3];
ZydisInternalElementType elementType : 5;
ZydisInternalElementType elementType ZYDIS_BITFIELD(5);
union
{
uint8_t encoding;
struct
{
uint8_t type : 3;
uint8_t type ZYDIS_BITFIELD(3);
union
{
ZydisRegister reg;
uint8_t id : 6;
uint8_t id ZYDIS_BITFIELD(6);
} reg;
} reg;
struct
{
uint8_t seg : 3;
uint8_t base : 3;
ZydisOperandAction baseAction : 3;
uint8_t seg ZYDIS_BITFIELD(3);
uint8_t base ZYDIS_BITFIELD(3);
ZydisOperandAction baseAction ZYDIS_BITFIELD(3);
} mem;
} op;
} ZydisOperandDefinition;
@ -637,10 +639,10 @@ enum ZydisMaskPolicies
/* ---------------------------------------------------------------------------------------------- */
#define ZYDIS_INSTRUCTION_DEFINITION_BASE \
ZydisInstructionMnemonic mnemonic : 11; \
uint8_t operandCount : 4; \
uint16_t operandReference : 15; \
uint8_t operandSizeMap : 3
ZydisInstructionMnemonic mnemonic ZYDIS_BITFIELD(11); \
uint8_t operandCount ZYDIS_BITFIELD( 4); \
uint16_t operandReference ZYDIS_BITFIELD(15); \
uint8_t operandSizeMap ZYDIS_BITFIELD( 3)
/**
* @brief Defines the @c ZydisInstructionDefinition struct.
@ -653,16 +655,16 @@ typedef struct ZydisInstructionDefinition_
typedef struct ZydisInstructionDefinitionDEFAULT_
{
ZYDIS_INSTRUCTION_DEFINITION_BASE;
ZydisBool acceptsLock : 1;
ZydisBool acceptsREP : 1;
ZydisBool acceptsREPEREPZ : 1;
ZydisBool acceptsREPNEREPNZ : 1;
ZydisBool acceptsBOUND : 1;
ZydisBool acceptsXACQUIRE : 1;
ZydisBool acceptsXRELEASE : 1;
ZydisBool acceptsHLEWithoutLock : 1;
ZydisBool acceptsBranchHints : 1;
ZydisBool acceptsSegment : 1;
ZydisBool acceptsLock ZYDIS_BITFIELD(1);
ZydisBool acceptsREP ZYDIS_BITFIELD(1);
ZydisBool acceptsREPEREPZ ZYDIS_BITFIELD(1);
ZydisBool acceptsREPNEREPNZ ZYDIS_BITFIELD(1);
ZydisBool acceptsBOUND ZYDIS_BITFIELD(1);
ZydisBool acceptsXACQUIRE ZYDIS_BITFIELD(1);
ZydisBool acceptsXRELEASE ZYDIS_BITFIELD(1);
ZydisBool acceptsHLEWithoutLock ZYDIS_BITFIELD(1);
ZydisBool acceptsBranchHints ZYDIS_BITFIELD(1);
ZydisBool acceptsSegment ZYDIS_BITFIELD(1);
} ZydisInstructionDefinitionDEFAULT;
typedef struct ZydisInstructionDefinition3DNOW_
@ -678,27 +680,27 @@ typedef struct ZydisInstructionDefinitionXOP_
typedef struct ZydisInstructionDefinitionVEX_
{
ZYDIS_INSTRUCTION_DEFINITION_BASE;
ZydisVEXStaticBroadcast broadcast : 3;
ZydisVEXStaticBroadcast broadcast ZYDIS_BITFIELD(3);
} ZydisInstructionDefinitionVEX;
typedef struct ZydisInstructionDefinitionEVEX_
{
ZYDIS_INSTRUCTION_DEFINITION_BASE;
ZydisInternalVectorLength vectorLength: 2;
ZydisEVEXTupleType tupleType : 4;
ZydisInternalElementSize elementSize : 4;
ZydisEVEXFunctionality functionality : 2;
ZydisMaskPolicy maskPolicy : 2;
ZydisEVEXStaticBroadcast broadcast : 4;
ZydisInternalVectorLength vectorLength ZYDIS_BITFIELD(2);
ZydisEVEXTupleType tupleType ZYDIS_BITFIELD(4);
ZydisInternalElementSize elementSize ZYDIS_BITFIELD(4);
ZydisEVEXFunctionality functionality ZYDIS_BITFIELD(2);
ZydisMaskPolicy maskPolicy ZYDIS_BITFIELD(2);
ZydisEVEXStaticBroadcast broadcast ZYDIS_BITFIELD(4);
} ZydisInstructionDefinitionEVEX;
typedef struct ZydisInstructionDefinitionMVEX_
{
ZYDIS_INSTRUCTION_DEFINITION_BASE;
ZydisMVEXFunctionality functionality : 5;
ZydisMaskPolicy maskPolicy : 2;
ZydisBool hasElementGranularity : 1;
ZydisMVEXStaticBroadcast broadcast : 3;
ZydisMVEXFunctionality functionality ZYDIS_BITFIELD(5);
ZydisMaskPolicy maskPolicy ZYDIS_BITFIELD(2);
ZydisBool hasElementGranularity ZYDIS_BITFIELD(1);
ZydisMVEXStaticBroadcast broadcast ZYDIS_BITFIELD(3);
} ZydisInstructionDefinitionMVEX;
/* ---------------------------------------------------------------------------------------------- */

View File

@ -45,7 +45,7 @@ typedef struct ZydisDecoderContext_
/**
* @brief A pointer to the @c ZydisInstructionDecoder instance.
*/
ZydisInstructionDecoder* decoder;
const ZydisInstructionDecoder* decoder;
/**
* @brief The input buffer.
*/
@ -222,6 +222,48 @@ static ZydisStatus ZydisInputNext(ZydisDecoderContext* context, ZydisInstruction
return ZYDIS_STATUS_NO_MORE_DATA;
}
/**
* @brief Reads a variable amount of bytes from the current read-position of the input data-source
* and increases the read-position by specified amount of bytes afterwards.
*
* @param context A pointer to the @c ZydisDecoderContext instance.
* @param info A pointer to the @c ZydisInstructionInfo struct.
* @param value A pointer to the memory that receives the byte from the input
* data-source.
* @param numberOfBytes The number of bytes to read from the input data-source.
*
* @return A zydis status code.
*
* This function acts like a subsequent call of @c ZydisInputPeek and @c ZydisInputSkip.
*/
static ZydisStatus ZydisInputNextBytes(ZydisDecoderContext* context, ZydisInstructionInfo* info,
uint8_t* value, uint8_t numberOfBytes)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(info);
ZYDIS_ASSERT(value);
ZYDIS_ASSERT((numberOfBytes == 2) || (numberOfBytes == 4) || (numberOfBytes == 8));
if (info->length >= ZYDIS_MAX_INSTRUCTION_LENGTH)
{
return ZYDIS_STATUS_INSTRUCTION_TOO_LONG;
}
if (context->bufferLen >= numberOfBytes)
{
memcpy(&info->data[info->length], context->buffer, numberOfBytes);
info->length += numberOfBytes;
memcpy(value, context->buffer, numberOfBytes);
context->buffer += numberOfBytes;
context->bufferLen -= numberOfBytes;
return ZYDIS_STATUS_SUCCESS;
}
return ZYDIS_STATUS_NO_MORE_DATA;
}
/* ---------------------------------------------------------------------------------------------- */
/* Decoder functions */
/* ---------------------------------------------------------------------------------------------- */
@ -565,51 +607,41 @@ static ZydisStatus ZydisReadDisplacement(ZydisDecoderContext* context, ZydisInst
info->details.disp.dataSize = size;
info->details.disp.dataOffset = info->length;
switch (size)
{
case 8:
{
uint8_t value;
ZYDIS_CHECK(ZydisInputNext(context, info, &value));
info->details.disp.value.sqword = (int8_t)value;
info->details.disp.value.sqword = *(int8_t*)&value;
break;
}
case 16:
{
uint16_t data[2] = { 0, 0 };
ZYDIS_CHECK(ZydisInputNext(context, info, (uint8_t*)&data[1]));
ZYDIS_CHECK(ZydisInputNext(context, info, (uint8_t*)&data[0]));
info->details.disp.value.sqword = (int16_t)((data[0] << 8) | data[1]);
break;
uint16_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, info, (uint8_t*)&value, 2));
info->details.disp.value.sqword = *(int16_t*)&value;
break;
}
case 32:
{
uint32_t data[4] = { 0, 0, 0, 0 };
for (int i = ZYDIS_ARRAY_SIZE(data); i > 0; --i)
{
ZYDIS_CHECK(ZydisInputNext(context, info, (uint8_t*)&data[i - 1]));
}
info->details.disp.value.sqword =
(int32_t)((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]);
uint32_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, info, (uint8_t*)&value, 4));
info->details.disp.value.sqword = *(int32_t*)&value;
break;
}
case 64:
{
uint64_t data[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
for (int i = sizeof(data) / sizeof(data[0]); i > 0; --i)
{
ZYDIS_CHECK(ZydisInputNext(context, info, (uint8_t*)&data[i - 1]));
}
info->details.disp.value.sqword =
(int64_t)((data[0] << 56) | (data[1] << 48) | (data[2] << 40) | (data[3] << 32) |
(data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7]);
uint64_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, info, (uint8_t*)&value, 8));
info->details.disp.value.sqword = *(int64_t*)&value;
break;
}
default:
ZYDIS_UNREACHABLE;
}
// TODO: Fix endianess on big-endian systems
// TODO: Fix endianess on big-endian systems
return ZYDIS_STATUS_SUCCESS;
}
@ -656,10 +688,8 @@ static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context, ZydisInstruc
}
case 16:
{
uint16_t data[2] = { 0, 0 };
ZYDIS_CHECK(ZydisInputNext(context, info, (uint8_t*)&data[1]));
ZYDIS_CHECK(ZydisInputNext(context, info, (uint8_t*)&data[0]));
uint16_t value = (data[0] << 8) | data[1];
uint16_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, info, (uint8_t*)&value, 2));
if (isSigned)
{
info->details.imm[id].value.sqword = (int16_t)value;
@ -671,12 +701,8 @@ static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context, ZydisInstruc
}
case 32:
{
uint32_t data[4] = { 0, 0, 0, 0 };
for (int i = ZYDIS_ARRAY_SIZE(data); i > 0; --i)
{
ZYDIS_CHECK(ZydisInputNext(context, info, (uint8_t*)&data[i - 1]));
}
uint32_t value = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
uint32_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, info, (uint8_t*)&value, 4));
if (isSigned)
{
info->details.imm[id].value.sqword = (int32_t)value;
@ -688,14 +714,8 @@ static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context, ZydisInstruc
}
case 64:
{
uint64_t data[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
for (int i = ZYDIS_ARRAY_SIZE(data); i > 0; --i)
{
ZYDIS_CHECK(ZydisInputNext(context, info, (uint8_t*)&data[i - 1]));
}
uint64_t value =
(data[0] << 56) | (data[1] << 48) | (data[2] << 40) | (data[3] << 32) |
(data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
uint64_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, info, (uint8_t*)&value, 8));
if (isSigned)
{
info->details.imm[id].value.sqword = (int64_t)value;
@ -3773,6 +3793,8 @@ static ZydisStatus ZydisDecodeInstruction(ZydisDecoderContext* context, ZydisIns
const ZydisInstructionDefinitionEVEX* def =
(const ZydisInstructionDefinitionEVEX*)definition;
maskPolicy = def->maskPolicy;
// TODO: Check for invalid .vvvv value
break;
}
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
@ -3945,7 +3967,7 @@ ZydisStatus ZydisDecoderInitInstructionDecoderEx(ZydisInstructionDecoder* decode
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisDecoderDecodeBuffer(ZydisInstructionDecoder* decoder, const void* buffer,
ZydisStatus ZydisDecoderDecodeBuffer(const ZydisInstructionDecoder* decoder, const void* buffer,
size_t bufferLen, uint64_t instructionPointer, ZydisInstructionInfo* info)
{
if (!decoder)

View File

@ -181,7 +181,7 @@ static ZydisStatus ZydisStringBufferAppendFormat(char** buffer, size_t bufferLen
/* Intel style */
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintPrefixesIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterPrintPrefixesIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info)
@ -224,7 +224,7 @@ static ZydisStatus ZydisFormatterPrintPrefixesIntel(ZydisInstructionFormatter* f
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisFormatterPrintMnemonicIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info)
@ -242,7 +242,7 @@ static ZydisStatus ZydisFormatterPrintMnemonicIntel(ZydisInstructionFormatter* f
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterFormatOperandRegIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterFormatOperandRegIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -258,7 +258,7 @@ static ZydisStatus ZydisFormatterFormatOperandRegIntel(ZydisInstructionFormatter
return ZydisStringBufferAppend(buffer, bufferLen, ZYDIS_APPENDMODE, reg);
}
static ZydisStatus ZydisFormatterFormatOperandMemIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -325,7 +325,7 @@ static ZydisStatus ZydisFormatterFormatOperandMemIntel(ZydisInstructionFormatter
return ZydisStringBufferAppend(buffer, bufEnd - *buffer, ZYDIS_STRBUF_APPEND_MODE_DEFAULT, "]");
}
static ZydisStatus ZydisFormatterFormatOperandPtrIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterFormatOperandPtrIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -337,7 +337,7 @@ static ZydisStatus ZydisFormatterFormatOperandPtrIntel(ZydisInstructionFormatter
"0x%04"PRIX16":0x%08"PRIX32, operand->ptr.segment, operand->ptr.offset);
}
static ZydisStatus ZydisFormatterFormatOperandImmIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -382,7 +382,7 @@ static ZydisStatus ZydisFormatterFormatOperandImmIntel(ZydisInstructionFormatter
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintAddressIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand,
uint64_t address)
{
@ -405,7 +405,7 @@ static ZydisStatus ZydisFormatterPrintAddressIntel(ZydisInstructionFormatter* fo
}
}
static ZydisStatus ZydisFormatterPrintDisplacementIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -435,7 +435,7 @@ static ZydisStatus ZydisFormatterPrintDisplacementIntel(ZydisInstructionFormatte
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisFormatterPrintImmediateIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -486,7 +486,7 @@ static ZydisStatus ZydisFormatterPrintImmediateIntel(ZydisInstructionFormatter*
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintOperandSizeIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -578,7 +578,7 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(ZydisInstructionFormatter
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisFormatterPrintSegmentIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterPrintSegmentIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -616,7 +616,7 @@ static ZydisStatus ZydisFormatterPrintSegmentIntel(ZydisInstructionFormatter* fo
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisFormatterPrintDecoratorIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info, ZydisOperandInfo* operand)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info || !operand)
@ -809,7 +809,7 @@ static ZydisStatus ZydisFormatterPrintDecoratorIntel(ZydisInstructionFormatter*
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisFormatterFormatInstrIntel(ZydisInstructionFormatter* formatter,
static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisInstructionFormatter* formatter,
char** buffer, size_t bufferLen, ZydisInstructionInfo* info)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !info)
@ -1078,9 +1078,8 @@ ZydisStatus ZydisFormatterSetHook(ZydisInstructionFormatter* formatter,
return ZYDIS_STATUS_INVALID_PARAMETER;
}
ZydisStatus ZydisFormatterFormatInstruction(
ZydisInstructionFormatter* formatter, ZydisInstructionInfo* info, char* buffer,
size_t bufferLen)
ZydisStatus ZydisFormatterFormatInstruction(const ZydisInstructionFormatter* formatter,
ZydisInstructionInfo* info, char* buffer, size_t bufferLen)
{
if (!formatter || !info || !buffer || (bufferLen == 0))
{