mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 00:05:45 -04:00
dep: Add Zydis
This commit is contained in:
5074
dep/zydis/src/Decoder.c
Normal file
5074
dep/zydis/src/Decoder.c
Normal file
File diff suppressed because it is too large
Load Diff
174
dep/zydis/src/DecoderData.c
Normal file
174
dep/zydis/src/DecoderData.c
Normal file
@ -0,0 +1,174 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Internal/DecoderData.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Data tables */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Physical instruction encodings */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#include <Generated/InstructionEncodings.inc>
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Decoder tree */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#define ZYDIS_INVALID \
|
||||
{ ZYDIS_NODETYPE_INVALID, 0x00000000 }
|
||||
#define ZYDIS_FILTER(type, id) \
|
||||
{ type, id }
|
||||
#define ZYDIS_DEFINITION(encoding_id, id) \
|
||||
{ ZYDIS_NODETYPE_DEFINITION_MASK | encoding_id, id }
|
||||
|
||||
#include <Generated/DecoderTables.inc>
|
||||
|
||||
#undef ZYDIS_INVALID
|
||||
#undef ZYDIS_FILTER
|
||||
#undef ZYDIS_DEFINITION
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Decoder tree */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
const ZydisDecoderTreeNode zydis_decoder_tree_root = { ZYDIS_NODETYPE_FILTER_OPCODE, 0x0000 };
|
||||
|
||||
const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(const ZydisDecoderTreeNode* parent,
|
||||
ZyanU16 index)
|
||||
{
|
||||
switch (parent->type)
|
||||
{
|
||||
case ZYDIS_NODETYPE_FILTER_XOP:
|
||||
ZYAN_ASSERT(index < 13);
|
||||
return &FILTERS_XOP[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_VEX:
|
||||
ZYAN_ASSERT(index < 17);
|
||||
return &FILTERS_VEX[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_EMVEX:
|
||||
ZYAN_ASSERT(index < 49);
|
||||
return &FILTERS_EMVEX[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_OPCODE:
|
||||
ZYAN_ASSERT(index < 256);
|
||||
return &FILTERS_OPCODE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE:
|
||||
ZYAN_ASSERT(index < 4);
|
||||
return &FILTERS_MODE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_COMPACT:
|
||||
ZYAN_ASSERT(index < 3);
|
||||
return &FILTERS_MODE_COMPACT[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODRM_MOD:
|
||||
ZYAN_ASSERT(index < 4);
|
||||
return &FILTERS_MODRM_MOD[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODRM_MOD_COMPACT:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODRM_MOD_COMPACT[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODRM_REG:
|
||||
ZYAN_ASSERT(index < 8);
|
||||
return &FILTERS_MODRM_REG[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODRM_RM:
|
||||
ZYAN_ASSERT(index < 8);
|
||||
return &FILTERS_MODRM_RM[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_PREFIX_GROUP1:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_PREFIX_GROUP1[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX:
|
||||
ZYAN_ASSERT(index < 5);
|
||||
return &FILTERS_MANDATORY_PREFIX[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_OPERAND_SIZE:
|
||||
ZYAN_ASSERT(index < 3);
|
||||
return &FILTERS_OPERAND_SIZE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_ADDRESS_SIZE:
|
||||
ZYAN_ASSERT(index < 3);
|
||||
return &FILTERS_ADDRESS_SIZE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_VECTOR_LENGTH:
|
||||
ZYAN_ASSERT(index < 3);
|
||||
return &FILTERS_VECTOR_LENGTH[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_REX_W:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_REX_W[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_REX_B:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_REX_B[parent->value][index];
|
||||
#ifndef ZYDIS_DISABLE_AVX512
|
||||
case ZYDIS_NODETYPE_FILTER_EVEX_B:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_EVEX_B[parent->value][index];
|
||||
#endif
|
||||
#ifndef ZYDIS_DISABLE_KNC
|
||||
case ZYDIS_NODETYPE_FILTER_MVEX_E:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MVEX_E[parent->value][index];
|
||||
#endif
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_AMD:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_AMD[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_KNC:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_KNC[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_MPX:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_MPX[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_CET:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_CET[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_LZCNT:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_LZCNT[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_TZCNT:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_TZCNT[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_WBNOINVD:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_WBNOINVD[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_CLDEMOTE:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_CLDEMOTE[parent->value][index];
|
||||
default:
|
||||
ZYAN_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
|
||||
const ZydisInstructionEncodingInfo** info)
|
||||
{
|
||||
ZYAN_ASSERT(node->type & ZYDIS_NODETYPE_DEFINITION_MASK);
|
||||
const ZyanU8 class = (node->type) & 0x7F;
|
||||
ZYAN_ASSERT(class < ZYAN_ARRAY_LENGTH(INSTR_ENCODINGS));
|
||||
*info = &INSTR_ENCODINGS[class];
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
105
dep/zydis/src/Disassembler.c
Normal file
105
dep/zydis/src/Disassembler.c
Normal file
@ -0,0 +1,105 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Joel Hoener
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Disassembler.h>
|
||||
#include <Zycore/LibC.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Internal helpers */
|
||||
/* ============================================================================================== */
|
||||
|
||||
static ZyanStatus ZydisDisassemble(ZydisMachineMode machine_mode,
|
||||
ZyanU64 runtime_address, const void* buffer, ZyanUSize length,
|
||||
ZydisDisassembledInstruction *instruction, ZydisFormatterStyle style)
|
||||
{
|
||||
if (!buffer || !instruction)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
*instruction = (ZydisDisassembledInstruction)
|
||||
{
|
||||
.runtime_address = runtime_address
|
||||
};
|
||||
|
||||
// Derive the stack width from the address width.
|
||||
ZydisStackWidth stack_width;
|
||||
switch (machine_mode)
|
||||
{
|
||||
case ZYDIS_MACHINE_MODE_LONG_64:
|
||||
stack_width = ZYDIS_STACK_WIDTH_64;
|
||||
break;
|
||||
case ZYDIS_MACHINE_MODE_LONG_COMPAT_32:
|
||||
case ZYDIS_MACHINE_MODE_LEGACY_32:
|
||||
stack_width = ZYDIS_STACK_WIDTH_32;
|
||||
break;
|
||||
case ZYDIS_MACHINE_MODE_LONG_COMPAT_16:
|
||||
case ZYDIS_MACHINE_MODE_LEGACY_16:
|
||||
case ZYDIS_MACHINE_MODE_REAL_16:
|
||||
stack_width = ZYDIS_STACK_WIDTH_16;
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZydisDecoder decoder;
|
||||
ZYAN_CHECK(ZydisDecoderInit(&decoder, machine_mode, stack_width));
|
||||
|
||||
ZydisDecoderContext ctx;
|
||||
ZYAN_CHECK(ZydisDecoderDecodeInstruction(&decoder, &ctx, buffer, length, &instruction->info));
|
||||
ZYAN_CHECK(ZydisDecoderDecodeOperands(&decoder, &ctx, &instruction->info,
|
||||
instruction->operands, instruction->info.operand_count));
|
||||
|
||||
ZydisFormatter formatter;
|
||||
ZYAN_CHECK(ZydisFormatterInit(&formatter, style));
|
||||
ZYAN_CHECK(ZydisFormatterFormatInstruction(&formatter, &instruction->info,
|
||||
instruction->operands, instruction->info.operand_count_visible, instruction->text,
|
||||
sizeof(instruction->text), runtime_address, ZYAN_NULL));
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Public functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
ZyanStatus ZydisDisassembleIntel(ZydisMachineMode machine_mode,
|
||||
ZyanU64 runtime_address, const void* buffer, ZyanUSize length,
|
||||
ZydisDisassembledInstruction *instruction)
|
||||
{
|
||||
return ZydisDisassemble(machine_mode, runtime_address, buffer, length, instruction,
|
||||
ZYDIS_FORMATTER_STYLE_INTEL);
|
||||
}
|
||||
|
||||
ZyanStatus ZydisDisassembleATT(ZydisMachineMode machine_mode,
|
||||
ZyanU64 runtime_address, const void* buffer, ZyanUSize length,
|
||||
ZydisDisassembledInstruction *instruction)
|
||||
{
|
||||
return ZydisDisassemble(machine_mode, runtime_address, buffer, length, instruction,
|
||||
ZYDIS_FORMATTER_STYLE_ATT);
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
656
dep/zydis/src/Formatter.c
Normal file
656
dep/zydis/src/Formatter.c
Normal file
@ -0,0 +1,656 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd, Joel Hoener
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zycore/LibC.h>
|
||||
#include <Zydis/Formatter.h>
|
||||
#include <Zydis/Internal/FormatterATT.h>
|
||||
#include <Zydis/Internal/FormatterIntel.h>
|
||||
#include <Zydis/Internal/String.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Constants */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Formatter presets */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
static const ZydisFormatter* const FORMATTER_PRESETS[ZYDIS_FORMATTER_STYLE_MAX_VALUE + 1] =
|
||||
{
|
||||
&FORMATTER_ATT,
|
||||
&FORMATTER_INTEL,
|
||||
&FORMATTER_INTEL_MASM
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Internal functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Helper functions */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
void ZydisFormatterBufferInit(ZydisFormatterBuffer* buffer, char* user_buffer,
|
||||
ZyanUSize length)
|
||||
{
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(user_buffer);
|
||||
ZYAN_ASSERT(length);
|
||||
|
||||
buffer->is_token_list = ZYAN_FALSE;
|
||||
buffer->capacity = 0;
|
||||
buffer->string.flags = ZYAN_STRING_HAS_FIXED_CAPACITY;
|
||||
buffer->string.vector.allocator = ZYAN_NULL;
|
||||
buffer->string.vector.growth_factor = 1;
|
||||
buffer->string.vector.shrink_threshold = 0;
|
||||
buffer->string.vector.destructor = ZYAN_NULL;
|
||||
buffer->string.vector.element_size = sizeof(char);
|
||||
buffer->string.vector.size = 1;
|
||||
buffer->string.vector.capacity = length;
|
||||
buffer->string.vector.data = user_buffer;
|
||||
|
||||
*user_buffer = '\0';
|
||||
}
|
||||
|
||||
void ZydisFormatterBufferInitTokenized(ZydisFormatterBuffer* buffer,
|
||||
ZydisFormatterToken** first_token, void* user_buffer, ZyanUSize length)
|
||||
{
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(first_token);
|
||||
ZYAN_ASSERT(user_buffer);
|
||||
ZYAN_ASSERT(length);
|
||||
|
||||
*first_token = user_buffer;
|
||||
(*first_token)->type = ZYDIS_TOKEN_INVALID;
|
||||
(*first_token)->next = 0;
|
||||
|
||||
user_buffer = (ZyanU8*)user_buffer + sizeof(ZydisFormatterToken);
|
||||
length -= sizeof(ZydisFormatterToken);
|
||||
|
||||
buffer->is_token_list = ZYAN_TRUE;
|
||||
buffer->capacity = length;
|
||||
buffer->string.flags = ZYAN_STRING_HAS_FIXED_CAPACITY;
|
||||
buffer->string.vector.allocator = ZYAN_NULL;
|
||||
buffer->string.vector.growth_factor = 1;
|
||||
buffer->string.vector.shrink_threshold = 0;
|
||||
buffer->string.vector.destructor = ZYAN_NULL;
|
||||
buffer->string.vector.element_size = sizeof(char);
|
||||
buffer->string.vector.size = 1;
|
||||
buffer->string.vector.capacity = length;
|
||||
buffer->string.vector.data = user_buffer;
|
||||
|
||||
*(char*)user_buffer = '\0';
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Initialization */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle style)
|
||||
{
|
||||
if (!formatter || ((ZyanUSize)style > ZYDIS_FORMATTER_STYLE_MAX_VALUE))
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZYAN_MEMCPY(formatter, FORMATTER_PRESETS[style], sizeof(*formatter));
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Setter */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterSetProperty(ZydisFormatter* formatter, ZydisFormatterProperty property,
|
||||
ZyanUPointer value)
|
||||
{
|
||||
if (!formatter)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZydisNumericBase base = (ZydisNumericBase)(-1);
|
||||
ZyanU8 index = 0xFF;
|
||||
|
||||
switch (property)
|
||||
{
|
||||
case ZYDIS_FORMATTER_PROP_FORCE_SIZE:
|
||||
{
|
||||
formatter->force_memory_size = (value) ? ZYAN_TRUE : ZYAN_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_FORCE_SEGMENT:
|
||||
{
|
||||
formatter->force_memory_segment = (value) ? ZYAN_TRUE : ZYAN_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_FORCE_SCALE_ONE:
|
||||
{
|
||||
formatter->force_memory_scale = (value) ? ZYAN_TRUE : ZYAN_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES:
|
||||
{
|
||||
formatter->force_relative_branches = (value) ? ZYAN_TRUE : ZYAN_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL:
|
||||
{
|
||||
formatter->force_relative_riprel = (value) ? ZYAN_TRUE : ZYAN_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE:
|
||||
{
|
||||
formatter->print_branch_size = (value) ? ZYAN_TRUE : ZYAN_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_DETAILED_PREFIXES:
|
||||
{
|
||||
formatter->detailed_prefixes = (value) ? ZYAN_TRUE : ZYAN_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_ADDR_BASE:
|
||||
{
|
||||
if (value > ZYDIS_NUMERIC_BASE_MAX_VALUE)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->addr_base = (ZydisNumericBase)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_ADDR_SIGNEDNESS:
|
||||
{
|
||||
if (value > ZYDIS_SIGNEDNESS_MAX_VALUE)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->addr_signedness = (ZydisSignedness)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_ADDR_PADDING_ABSOLUTE:
|
||||
{
|
||||
if (((ZydisPadding)value != ZYDIS_PADDING_AUTO) &&
|
||||
(value > 0xFF))
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->addr_padding_absolute = (ZydisPadding)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_ADDR_PADDING_RELATIVE:
|
||||
{
|
||||
if (((ZydisPadding)value != ZYDIS_PADDING_AUTO) &&
|
||||
(value > 0xFF))
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->addr_padding_relative = (ZydisPadding)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_DISP_BASE:
|
||||
{
|
||||
if (value > ZYDIS_NUMERIC_BASE_MAX_VALUE)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->disp_base = (ZydisNumericBase)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_DISP_SIGNEDNESS:
|
||||
{
|
||||
if (value > ZYDIS_SIGNEDNESS_MAX_VALUE)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->disp_signedness = (ZydisSignedness)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_DISP_PADDING:
|
||||
{
|
||||
if ((ZydisPadding)value == ZYDIS_PADDING_AUTO)
|
||||
{
|
||||
if ((ZyanUSize)formatter->style > ZYDIS_FORMATTER_STYLE_MAX_VALUE)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->disp_padding = FORMATTER_PRESETS[formatter->style]->disp_padding;
|
||||
}
|
||||
else if (value > 0xFF)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->disp_padding = (ZydisPadding)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_IMM_BASE:
|
||||
{
|
||||
if (value > ZYDIS_NUMERIC_BASE_MAX_VALUE)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->imm_base = (ZydisNumericBase)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_IMM_SIGNEDNESS:
|
||||
{
|
||||
if (value > ZYDIS_SIGNEDNESS_MAX_VALUE)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->imm_signedness = (ZydisSignedness)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_IMM_PADDING:
|
||||
{
|
||||
if ((ZydisPadding)value == ZYDIS_PADDING_AUTO)
|
||||
{
|
||||
if ((ZyanUSize)formatter->style > ZYDIS_FORMATTER_STYLE_MAX_VALUE)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->imm_padding = FORMATTER_PRESETS[formatter->style]->imm_padding;
|
||||
}
|
||||
else if (value > 0xFF)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
formatter->imm_padding = (ZydisPadding)value;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_UPPERCASE_PREFIXES:
|
||||
{
|
||||
formatter->case_prefixes = (value) ? ZYDIS_LETTER_CASE_UPPER : ZYDIS_LETTER_CASE_DEFAULT;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_UPPERCASE_MNEMONIC:
|
||||
{
|
||||
formatter->case_mnemonic = (value) ? ZYDIS_LETTER_CASE_UPPER : ZYDIS_LETTER_CASE_DEFAULT;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_UPPERCASE_REGISTERS:
|
||||
{
|
||||
formatter->case_registers = (value) ? ZYDIS_LETTER_CASE_UPPER : ZYDIS_LETTER_CASE_DEFAULT;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_UPPERCASE_TYPECASTS:
|
||||
{
|
||||
formatter->case_typecasts = (value) ? ZYDIS_LETTER_CASE_UPPER : ZYDIS_LETTER_CASE_DEFAULT;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_UPPERCASE_DECORATORS:
|
||||
{
|
||||
formatter->case_decorators = (value) ? ZYDIS_LETTER_CASE_UPPER : ZYDIS_LETTER_CASE_DEFAULT;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_DEC_PREFIX:
|
||||
{
|
||||
base = ZYDIS_NUMERIC_BASE_DEC;
|
||||
index = 0;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_DEC_SUFFIX:
|
||||
{
|
||||
base = ZYDIS_NUMERIC_BASE_DEC;
|
||||
index = 1;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_HEX_UPPERCASE:
|
||||
{
|
||||
formatter->hex_uppercase = (value) ? ZYAN_TRUE : ZYAN_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_HEX_PREFIX:
|
||||
{
|
||||
base = ZYDIS_NUMERIC_BASE_HEX;
|
||||
index = 0;
|
||||
break;
|
||||
}
|
||||
case ZYDIS_FORMATTER_PROP_HEX_SUFFIX:
|
||||
{
|
||||
base = ZYDIS_NUMERIC_BASE_HEX;
|
||||
index = 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
// Set prefix or suffix
|
||||
if (base != (ZydisNumericBase)(-1))
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
const ZyanUSize len = ZYAN_STRLEN((char*)value);
|
||||
if (len > 10)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
ZYAN_MEMCPY(formatter->number_format[base][index].buffer, (void*)value, len);
|
||||
formatter->number_format[base][index].buffer[len] = '\0';
|
||||
formatter->number_format[base][index].string_data.string.vector.data =
|
||||
formatter->number_format[base][index].buffer;
|
||||
formatter->number_format[base][index].string_data.string.vector.size = len + 1;
|
||||
formatter->number_format[base][index].string =
|
||||
&formatter->number_format[base][index].string_data;
|
||||
} else
|
||||
{
|
||||
formatter->number_format[base][index].string = ZYAN_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterSetHook(ZydisFormatter* formatter, ZydisFormatterFunction type,
|
||||
const void** callback)
|
||||
{
|
||||
if (!formatter || !callback || ((ZyanUSize)type > ZYDIS_FORMATTER_FUNC_MAX_VALUE))
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
const void* const temp = *callback;
|
||||
|
||||
// The following code relies on the order of the enum values and the function fields inside
|
||||
// the `ZydisFormatter` struct
|
||||
|
||||
#ifdef ZYAN_DEBUG
|
||||
const ZyanUPointer* test = (ZyanUPointer*)(&formatter->func_pre_instruction + type);
|
||||
switch (type)
|
||||
{
|
||||
case ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_pre_instruction ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_post_instruction ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_format_instruction); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRE_OPERAND:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_pre_operand ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_POST_OPERAND:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_post_operand ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_format_operand_reg); break;
|
||||
case ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_format_operand_mem); break;
|
||||
case ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_format_operand_ptr); break;
|
||||
case ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_format_operand_imm); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_mnemonic ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_REGISTER:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_register ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_address_abs ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_address_rel ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_DISP:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_disp ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_IMM:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_imm ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_typecast ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_segment ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_prefixes ); break;
|
||||
case ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR:
|
||||
ZYAN_ASSERT(test == (ZyanUPointer*)&formatter->func_print_decorator ); break;
|
||||
default:
|
||||
ZYAN_UNREACHABLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
*callback = *(const void**)(&formatter->func_pre_instruction + type);
|
||||
if (!temp)
|
||||
{
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
ZYAN_MEMCPY(&formatter->func_pre_instruction + type, &temp, sizeof(ZyanUPointer));
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Formatting */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
|
||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands,
|
||||
ZyanU8 operand_count, char* buffer, ZyanUSize length, ZyanU64 runtime_address, void* user_data)
|
||||
{
|
||||
if (!formatter || !instruction || (operand_count && !operands) ||
|
||||
(operand_count > ZYDIS_MAX_OPERAND_COUNT) ||
|
||||
(operand_count < instruction->operand_count_visible) || !buffer || (length == 0))
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZydisFormatterBuffer formatter_buffer;
|
||||
ZydisFormatterBufferInit(&formatter_buffer, buffer, length);
|
||||
|
||||
ZydisFormatterContext context;
|
||||
context.instruction = instruction;
|
||||
context.operands = operands;
|
||||
context.runtime_address = runtime_address;
|
||||
context.operand = ZYAN_NULL;
|
||||
context.user_data = user_data;
|
||||
|
||||
if (formatter->func_pre_instruction)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_pre_instruction(formatter, &formatter_buffer, &context));
|
||||
}
|
||||
|
||||
ZYAN_CHECK(formatter->func_format_instruction(formatter, &formatter_buffer, &context));
|
||||
|
||||
if (formatter->func_post_instruction)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_post_instruction(formatter, &formatter_buffer, &context));
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
|
||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
|
||||
char* buffer, ZyanUSize length, ZyanU64 runtime_address, void* user_data)
|
||||
{
|
||||
if (!formatter || !instruction || !operand || !buffer || (length == 0))
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZydisFormatterBuffer formatter_buffer;
|
||||
ZydisFormatterBufferInit(&formatter_buffer, buffer, length);
|
||||
|
||||
ZydisFormatterContext context;
|
||||
context.instruction = instruction;
|
||||
context.operands = ZYAN_NULL;
|
||||
context.runtime_address = runtime_address;
|
||||
context.operand = operand;
|
||||
context.user_data = user_data;
|
||||
|
||||
// We ignore `ZYDIS_STATUS_SKIP_TOKEN` for all operand-functions as it does not make any sense
|
||||
// to skip the only operand printed by this function
|
||||
|
||||
if (formatter->func_pre_operand)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_pre_operand(formatter, &formatter_buffer, &context));
|
||||
}
|
||||
|
||||
switch (context.operand->type)
|
||||
{
|
||||
case ZYDIS_OPERAND_TYPE_REGISTER:
|
||||
ZYAN_CHECK(formatter->func_format_operand_reg(formatter, &formatter_buffer, &context));
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||
ZYAN_CHECK(formatter->func_format_operand_mem(formatter, &formatter_buffer, &context));
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||
ZYAN_CHECK(formatter->func_format_operand_imm(formatter, &formatter_buffer, &context));
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_POINTER:
|
||||
ZYAN_CHECK(formatter->func_format_operand_ptr(formatter, &formatter_buffer, &context));
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (formatter->func_post_operand)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_post_operand(formatter, &formatter_buffer, &context));
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Tokenizing */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* formatter,
|
||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands,
|
||||
ZyanU8 operand_count, void* buffer, ZyanUSize length, ZyanU64 runtime_address,
|
||||
ZydisFormatterTokenConst** token, void* user_data)
|
||||
{
|
||||
if (!formatter || !instruction || (operand_count && !operands) ||
|
||||
(operand_count > ZYDIS_MAX_OPERAND_COUNT) ||
|
||||
(operand_count < instruction->operand_count_visible) || !buffer ||
|
||||
(length <= sizeof(ZydisFormatterToken)) || !token)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZydisFormatterBuffer formatter_buffer;
|
||||
ZydisFormatterToken* first_token;
|
||||
ZydisFormatterBufferInitTokenized(&formatter_buffer, &first_token, buffer, length);
|
||||
|
||||
ZydisFormatterContext context;
|
||||
context.instruction = instruction;
|
||||
context.operands = operands;
|
||||
context.runtime_address = runtime_address;
|
||||
context.operand = ZYAN_NULL;
|
||||
context.user_data = user_data;
|
||||
|
||||
if (formatter->func_pre_instruction)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_pre_instruction(formatter, &formatter_buffer, &context));
|
||||
}
|
||||
|
||||
ZYAN_CHECK(formatter->func_format_instruction(formatter, &formatter_buffer, &context));
|
||||
|
||||
if (formatter->func_post_instruction)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_post_instruction(formatter, &formatter_buffer, &context));
|
||||
}
|
||||
|
||||
if (first_token->next)
|
||||
{
|
||||
*token = (ZydisFormatterTokenConst*)((ZyanU8*)first_token + sizeof(ZydisFormatterToken) +
|
||||
first_token->next);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
*token = first_token;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterTokenizeOperand(const ZydisFormatter* formatter,
|
||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
|
||||
void* buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst** token,
|
||||
void* user_data)
|
||||
{
|
||||
if (!formatter || !instruction || !operand || !buffer ||
|
||||
(length <= sizeof(ZydisFormatterToken)) || !token)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZydisFormatterToken* first_token;
|
||||
ZydisFormatterBuffer formatter_buffer;
|
||||
ZydisFormatterBufferInitTokenized(&formatter_buffer, &first_token, buffer, length);
|
||||
|
||||
ZydisFormatterContext context;
|
||||
context.instruction = instruction;
|
||||
context.operands = ZYAN_NULL;
|
||||
context.runtime_address = runtime_address;
|
||||
context.operand = operand;
|
||||
context.user_data = user_data;
|
||||
|
||||
// We ignore `ZYDIS_STATUS_SKIP_TOKEN` for all operand-functions as it does not make any sense
|
||||
// to skip the only operand printed by this function
|
||||
|
||||
if (formatter->func_pre_operand)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_pre_operand(formatter, &formatter_buffer, &context));
|
||||
}
|
||||
|
||||
switch (context.operand->type)
|
||||
{
|
||||
case ZYDIS_OPERAND_TYPE_REGISTER:
|
||||
ZYAN_CHECK(formatter->func_format_operand_reg(formatter, &formatter_buffer, &context));
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||
ZYAN_CHECK(formatter->func_format_operand_mem(formatter, &formatter_buffer, &context));
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||
ZYAN_CHECK(formatter->func_format_operand_imm(formatter, &formatter_buffer, &context));
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_POINTER:
|
||||
ZYAN_CHECK(formatter->func_format_operand_ptr(formatter, &formatter_buffer, &context));
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (formatter->func_post_operand)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_post_operand(formatter, &formatter_buffer, &context));
|
||||
}
|
||||
|
||||
if (first_token->next)
|
||||
{
|
||||
*token = (ZydisFormatterTokenConst*)((ZyanU8*)first_token + sizeof(ZydisFormatterToken) +
|
||||
first_token->next);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
*token = first_token;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ============================================================================================== */
|
422
dep/zydis/src/FormatterATT.c
Normal file
422
dep/zydis/src/FormatterATT.c
Normal file
@ -0,0 +1,422 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd, Joel Hoener
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Internal/FormatterATT.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Constants */
|
||||
/* ============================================================================================== */
|
||||
|
||||
#include <Generated/FormatterStrings.inc>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Formatter functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Instruction */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterATTFormatInstruction(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
ZYAN_ASSERT(context->instruction);
|
||||
ZYAN_ASSERT(context->operands);
|
||||
|
||||
ZYAN_CHECK(formatter->func_print_prefixes(formatter, buffer, context));
|
||||
ZYAN_CHECK(formatter->func_print_mnemonic(formatter, buffer, context));
|
||||
|
||||
ZyanUPointer state_mnemonic;
|
||||
ZYDIS_BUFFER_REMEMBER(buffer, state_mnemonic);
|
||||
|
||||
const ZyanI8 c = (ZyanI8)context->instruction->operand_count_visible - 1;
|
||||
for (ZyanI8 i = c; i >= 0; --i)
|
||||
{
|
||||
const ZydisDecodedOperand* const operand = &context->operands[i];
|
||||
|
||||
// Print embedded-mask registers as decorator instead of a regular operand
|
||||
if ((i == 1) && (operand->type == ZYDIS_OPERAND_TYPE_REGISTER) &&
|
||||
(operand->encoding == ZYDIS_OPERAND_ENCODING_MASK))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ZyanUPointer buffer_state;
|
||||
ZYDIS_BUFFER_REMEMBER(buffer, buffer_state);
|
||||
|
||||
if (buffer_state != state_mnemonic)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_OPERAND);
|
||||
} else
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_MNEMONIC);
|
||||
}
|
||||
|
||||
// Set current operand
|
||||
context->operand = operand;
|
||||
|
||||
ZyanStatus status;
|
||||
if (formatter->func_pre_operand)
|
||||
{
|
||||
status = formatter->func_pre_operand(formatter, buffer, context);
|
||||
if (status == ZYDIS_STATUS_SKIP_TOKEN)
|
||||
{
|
||||
ZYAN_CHECK(ZydisFormatterBufferRestore(buffer, buffer_state));
|
||||
continue;
|
||||
}
|
||||
if (!ZYAN_SUCCESS(status))
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
switch (operand->type)
|
||||
{
|
||||
case ZYDIS_OPERAND_TYPE_REGISTER:
|
||||
status = formatter->func_format_operand_reg(formatter, buffer, context);
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||
status = formatter->func_format_operand_mem(formatter, buffer, context);
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_POINTER:
|
||||
status = formatter->func_format_operand_ptr(formatter, buffer, context);
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||
status = formatter->func_format_operand_imm(formatter, buffer, context);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
if (status == ZYDIS_STATUS_SKIP_TOKEN)
|
||||
{
|
||||
ZYAN_CHECK(ZydisFormatterBufferRestore(buffer, buffer_state));
|
||||
continue;
|
||||
}
|
||||
if (!ZYAN_SUCCESS(status))
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
if (formatter->func_post_operand)
|
||||
{
|
||||
status = formatter->func_post_operand(formatter, buffer, context);
|
||||
if (status == ZYDIS_STATUS_SKIP_TOKEN)
|
||||
{
|
||||
ZYAN_CHECK(ZydisFormatterBufferRestore(buffer, buffer_state));
|
||||
continue;
|
||||
}
|
||||
if (ZYAN_SUCCESS(status))
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(ZYDIS_DISABLE_AVX512) || !defined(ZYDIS_DISABLE_KNC)
|
||||
if ((context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX) ||
|
||||
(context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX))
|
||||
{
|
||||
if ((i == 0) &&
|
||||
(context->instruction->operand_count_visible > 1) &&
|
||||
(context->operands[1].encoding == ZYDIS_OPERAND_ENCODING_MASK))
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_MASK));
|
||||
}
|
||||
if (operand->type == ZYDIS_OPERAND_TYPE_MEMORY)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_BC));
|
||||
if (context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_CONVERSION));
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_EH));
|
||||
}
|
||||
} else
|
||||
{
|
||||
ZyanBool decorate_operand;
|
||||
if (i == (context->instruction->operand_count_visible - 1))
|
||||
{
|
||||
decorate_operand = operand->type != ZYDIS_OPERAND_TYPE_IMMEDIATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
decorate_operand =
|
||||
(context->instruction->operand_count_visible > (i + 1)) &&
|
||||
((context->operands[i + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE) ||
|
||||
(context->operands[i + 1].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN));
|
||||
}
|
||||
if (decorate_operand)
|
||||
{
|
||||
if (context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_SWIZZLE));
|
||||
}
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_RC));
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_SAE));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Operands */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterATTFormatOperandMEM(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZYAN_CHECK(formatter->func_print_segment(formatter, buffer, context));
|
||||
|
||||
const ZyanBool absolute = !formatter->force_relative_riprel &&
|
||||
(context->runtime_address != ZYDIS_RUNTIME_ADDRESS_NONE);
|
||||
if (absolute && context->operand->mem.disp.has_displacement &&
|
||||
(context->operand->mem.index == ZYDIS_REGISTER_NONE) &&
|
||||
((context->operand->mem.base == ZYDIS_REGISTER_NONE) ||
|
||||
(context->operand->mem.base == ZYDIS_REGISTER_EIP ) ||
|
||||
(context->operand->mem.base == ZYDIS_REGISTER_RIP )))
|
||||
{
|
||||
// EIP/RIP-relative or absolute-displacement address operand
|
||||
ZYAN_CHECK(formatter->func_print_address_abs(formatter, buffer, context));
|
||||
} else
|
||||
{
|
||||
const ZyanBool should_print_reg = context->operand->mem.base != ZYDIS_REGISTER_NONE;
|
||||
const ZyanBool should_print_idx = context->operand->mem.index != ZYDIS_REGISTER_NONE;
|
||||
const ZyanBool neither_reg_nor_idx = !should_print_reg && !should_print_idx;
|
||||
|
||||
// Regular memory operand
|
||||
if (neither_reg_nor_idx)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_address_abs(formatter, buffer, context));
|
||||
} else if (context->operand->mem.disp.has_displacement && context->operand->mem.disp.value)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_disp(formatter, buffer, context));
|
||||
}
|
||||
|
||||
if (neither_reg_nor_idx)
|
||||
{
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND(buffer, MEMORY_BEGIN_ATT);
|
||||
|
||||
if (should_print_reg)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->operand->mem.base));
|
||||
}
|
||||
if (should_print_idx)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_MEMORY);
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->operand->mem.index));
|
||||
if (context->operand->mem.scale &&
|
||||
(context->operand->mem.type != ZYDIS_MEMOP_TYPE_MIB) &&
|
||||
((context->operand->mem.scale > 1) || formatter->force_memory_scale))
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_DELIMITER);
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_MEMORY);
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
|
||||
ZYAN_CHECK(ZydisStringAppendDecU(&buffer->string, context->operand->mem.scale, 0,
|
||||
ZYAN_NULL, ZYAN_NULL));
|
||||
}
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND(buffer, MEMORY_END_ATT);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Elemental tokens */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterATTPrintMnemonic(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
ZYAN_ASSERT(context->instruction);
|
||||
ZYAN_ASSERT(context->operands);
|
||||
|
||||
const ZydisShortString* mnemonic = ZydisMnemonicGetStringWrapped(
|
||||
context->instruction->mnemonic);
|
||||
if (!mnemonic)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, INVALID_MNEMONIC, formatter->case_mnemonic);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_MNEMONIC);
|
||||
if (context->instruction->meta.branch_type == ZYDIS_BRANCH_TYPE_FAR)
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, &STR_FAR_ATT,
|
||||
formatter->case_mnemonic));
|
||||
}
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, mnemonic, formatter->case_mnemonic));
|
||||
|
||||
// Append operand-size suffix
|
||||
ZyanU32 size = 0;
|
||||
for (ZyanU8 i = 0; i < context->instruction->operand_count_visible; ++i)
|
||||
{
|
||||
const ZydisDecodedOperand* const operand = &context->operands[i];
|
||||
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
|
||||
((operand->mem.type == ZYDIS_MEMOP_TYPE_MEM) ||
|
||||
(operand->mem.type == ZYDIS_MEMOP_TYPE_VSIB)))
|
||||
{
|
||||
size = ZydisFormatterHelperGetExplicitSize(formatter, context, operand);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (size)
|
||||
{
|
||||
case 8: ZydisStringAppendShort(&buffer->string, &STR_SIZE_8_ATT ); break;
|
||||
case 16: ZydisStringAppendShort(&buffer->string, &STR_SIZE_16_ATT ); break;
|
||||
case 32: ZydisStringAppendShort(&buffer->string, &STR_SIZE_32_ATT ); break;
|
||||
case 64: ZydisStringAppendShort(&buffer->string, &STR_SIZE_64_ATT ); break;
|
||||
case 128: ZydisStringAppendShort(&buffer->string, &STR_SIZE_128_ATT); break;
|
||||
case 256: ZydisStringAppendShort(&buffer->string, &STR_SIZE_256_ATT); break;
|
||||
case 512: ZydisStringAppendShort(&buffer->string, &STR_SIZE_512_ATT); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (formatter->print_branch_size)
|
||||
{
|
||||
switch (context->instruction->meta.branch_type)
|
||||
{
|
||||
case ZYDIS_BRANCH_TYPE_NONE:
|
||||
break;
|
||||
case ZYDIS_BRANCH_TYPE_SHORT:
|
||||
return ZydisStringAppendShortCase(&buffer->string, &STR_SHORT,
|
||||
formatter->case_mnemonic);
|
||||
case ZYDIS_BRANCH_TYPE_NEAR:
|
||||
return ZydisStringAppendShortCase(&buffer->string, &STR_NEAR,
|
||||
formatter->case_mnemonic);
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterATTPrintRegister(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisRegister reg)
|
||||
{
|
||||
ZYAN_UNUSED(context);
|
||||
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZYDIS_BUFFER_APPEND(buffer, REGISTER);
|
||||
const ZydisShortString* str = ZydisRegisterGetStringWrapped(reg);
|
||||
if (!str)
|
||||
{
|
||||
return ZydisStringAppendShortCase(&buffer->string, &STR_INVALID_REG,
|
||||
formatter->case_registers);
|
||||
}
|
||||
return ZydisStringAppendShortCase(&buffer->string, str, formatter->case_registers);
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterATTPrintAddressABS(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
if ((context->instruction->meta.branch_type != ZYDIS_BRANCH_TYPE_NONE) &&
|
||||
(context->operand->type == ZYDIS_OPERAND_TYPE_MEMORY))
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, MUL);
|
||||
}
|
||||
|
||||
return ZydisFormatterBasePrintAddressABS(formatter, buffer, context);
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterATTPrintDISP(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_DISPLACEMENT);
|
||||
switch (formatter->disp_signedness)
|
||||
{
|
||||
case ZYDIS_SIGNEDNESS_AUTO:
|
||||
case ZYDIS_SIGNEDNESS_SIGNED:
|
||||
ZYDIS_STRING_APPEND_NUM_S(formatter, formatter->disp_base, &buffer->string,
|
||||
context->operand->mem.disp.value, formatter->disp_padding,
|
||||
formatter->hex_force_leading_number, ZYAN_FALSE);
|
||||
break;
|
||||
case ZYDIS_SIGNEDNESS_UNSIGNED:
|
||||
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->disp_base, &buffer->string,
|
||||
context->operand->mem.disp.value, formatter->disp_padding,
|
||||
formatter->hex_force_leading_number);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterATTPrintIMM(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZYDIS_BUFFER_APPEND(buffer, IMMEDIATE);
|
||||
return ZydisFormatterBasePrintIMM(formatter, buffer, context);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
797
dep/zydis/src/FormatterBase.c
Normal file
797
dep/zydis/src/FormatterBase.c
Normal file
@ -0,0 +1,797 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd, Joel Hoener
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Internal/FormatterBase.h>
|
||||
#include <Zydis/Utils.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Constants */
|
||||
/* ============================================================================================== */
|
||||
|
||||
#include <Generated/FormatterStrings.inc>
|
||||
|
||||
static const ZydisShortString* const STR_PREF_REX[16] =
|
||||
{
|
||||
&STR_PREF_REX_40,
|
||||
&STR_PREF_REX_41,
|
||||
&STR_PREF_REX_42,
|
||||
&STR_PREF_REX_43,
|
||||
&STR_PREF_REX_44,
|
||||
&STR_PREF_REX_45,
|
||||
&STR_PREF_REX_46,
|
||||
&STR_PREF_REX_47,
|
||||
&STR_PREF_REX_48,
|
||||
&STR_PREF_REX_49,
|
||||
&STR_PREF_REX_4A,
|
||||
&STR_PREF_REX_4B,
|
||||
&STR_PREF_REX_4C,
|
||||
&STR_PREF_REX_4D,
|
||||
&STR_PREF_REX_4E,
|
||||
&STR_PREF_REX_4F
|
||||
};
|
||||
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX[16] =
|
||||
{
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_40,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_41,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_42,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_43,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_44,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_45,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_46,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_47,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_48,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_49,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4A,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4B,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4C,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4D,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4E,
|
||||
(const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4F
|
||||
};
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Helper functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
ZyanU32 ZydisFormatterHelperGetExplicitSize(const ZydisFormatter* formatter,
|
||||
ZydisFormatterContext* context, const ZydisDecodedOperand* operand)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(context);
|
||||
ZYAN_ASSERT(operand);
|
||||
|
||||
ZYAN_ASSERT(operand->type == ZYDIS_OPERAND_TYPE_MEMORY);
|
||||
ZYAN_ASSERT((operand->mem.type == ZYDIS_MEMOP_TYPE_MEM) ||
|
||||
(operand->mem.type == ZYDIS_MEMOP_TYPE_VSIB));
|
||||
|
||||
if (formatter->force_memory_size)
|
||||
{
|
||||
return operand->size;
|
||||
}
|
||||
|
||||
if (!context->operands)
|
||||
{
|
||||
// Single operand formatting. We can not derive the explicit size by using the other
|
||||
// operands.
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (operand->id)
|
||||
{
|
||||
case 0:
|
||||
if (context->instruction->operand_count_visible < 2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if ((context->operands[1].type == ZYDIS_OPERAND_TYPE_UNUSED) ||
|
||||
(context->operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE))
|
||||
{
|
||||
return context->operands[0].size;
|
||||
}
|
||||
if (context->operands[0].size != context->operands[1].size)
|
||||
{
|
||||
return context->operands[0].size;
|
||||
}
|
||||
if ((context->operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER) &&
|
||||
(context->operands[1].visibility == ZYDIS_OPERAND_VISIBILITY_IMPLICIT) &&
|
||||
(context->operands[1].reg.value == ZYDIS_REGISTER_CL))
|
||||
{
|
||||
return context->operands[0].size;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (context->operands[operand->id - 1].size !=
|
||||
context->operands[operand->id].size)
|
||||
{
|
||||
return context->operands[operand->id].size;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Formatter functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Operands */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterBaseFormatOperandREG(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
return formatter->func_print_register(formatter, buffer, context, context->operand->reg.value);
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBaseFormatOperandPTR(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
|
||||
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string,
|
||||
context->operand->ptr.segment, 4, formatter->hex_force_leading_number);
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_SEGMENT);
|
||||
|
||||
ZyanU8 padding;
|
||||
switch (context->instruction->operand_width)
|
||||
{
|
||||
case 16:
|
||||
padding = 4;
|
||||
break;
|
||||
case 32:
|
||||
padding = 8;
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
|
||||
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string,
|
||||
context->operand->ptr.offset , padding, formatter->hex_force_leading_number);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBaseFormatOperandIMM(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
// The immediate operand contains an address
|
||||
if (context->operand->imm.is_relative)
|
||||
{
|
||||
const ZyanBool absolute = !formatter->force_relative_branches &&
|
||||
(context->runtime_address != ZYDIS_RUNTIME_ADDRESS_NONE);
|
||||
if (absolute)
|
||||
{
|
||||
return formatter->func_print_address_abs(formatter, buffer, context);
|
||||
}
|
||||
return formatter->func_print_address_rel(formatter, buffer, context);
|
||||
}
|
||||
|
||||
// The immediate operand contains an actual ordinal value
|
||||
return formatter->func_print_imm(formatter, buffer, context);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Elemental tokens */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterBasePrintAddressABS(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZyanU64 address;
|
||||
ZYAN_CHECK(ZydisCalcAbsoluteAddress(context->instruction, context->operand,
|
||||
context->runtime_address, &address));
|
||||
ZyanU8 padding = (formatter->addr_padding_absolute ==
|
||||
ZYDIS_PADDING_AUTO) ? 0 : (ZyanU8)formatter->addr_padding_absolute;
|
||||
if ((formatter->addr_padding_absolute == ZYDIS_PADDING_AUTO) &&
|
||||
(formatter->addr_base == ZYDIS_NUMERIC_BASE_HEX))
|
||||
{
|
||||
switch (context->instruction->stack_width)
|
||||
{
|
||||
case 16:
|
||||
padding = 4;
|
||||
address = (ZyanU16)address;
|
||||
break;
|
||||
case 32:
|
||||
padding = 8;
|
||||
address = (ZyanU32)address;
|
||||
break;
|
||||
case 64:
|
||||
padding = 16;
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_ADDRESS_ABS);
|
||||
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string, address, padding,
|
||||
formatter->hex_force_leading_number);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBasePrintAddressREL(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZyanU64 address;
|
||||
ZYAN_CHECK(ZydisCalcAbsoluteAddress(context->instruction, context->operand, 0, &address));
|
||||
|
||||
ZyanU8 padding = (formatter->addr_padding_relative ==
|
||||
ZYDIS_PADDING_AUTO) ? 0 : (ZyanU8)formatter->addr_padding_relative;
|
||||
if ((formatter->addr_padding_relative == ZYDIS_PADDING_AUTO) &&
|
||||
(formatter->addr_base == ZYDIS_NUMERIC_BASE_HEX))
|
||||
{
|
||||
switch (context->instruction->stack_width)
|
||||
{
|
||||
case 16:
|
||||
padding = 4;
|
||||
address = (ZyanU16)address;
|
||||
break;
|
||||
case 32:
|
||||
padding = 8;
|
||||
address = (ZyanU32)address;
|
||||
break;
|
||||
case 64:
|
||||
padding = 16;
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_ADDRESS_REL);
|
||||
switch (formatter->addr_signedness)
|
||||
{
|
||||
case ZYDIS_SIGNEDNESS_AUTO:
|
||||
case ZYDIS_SIGNEDNESS_SIGNED:
|
||||
ZYDIS_STRING_APPEND_NUM_S(formatter, formatter->addr_base, &buffer->string, address,
|
||||
padding, formatter->hex_force_leading_number, ZYAN_TRUE);
|
||||
break;
|
||||
case ZYDIS_SIGNEDNESS_UNSIGNED:
|
||||
ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_ADD));
|
||||
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string, address,
|
||||
padding, formatter->hex_force_leading_number);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBasePrintIMM(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
|
||||
|
||||
const ZyanBool is_signed =
|
||||
(formatter->imm_signedness == ZYDIS_SIGNEDNESS_SIGNED) ||
|
||||
(formatter->imm_signedness == ZYDIS_SIGNEDNESS_AUTO && (context->operand->imm.is_signed));
|
||||
if (is_signed && (context->operand->imm.value.s < 0))
|
||||
{
|
||||
ZYDIS_STRING_APPEND_NUM_S(formatter, formatter->imm_base, &buffer->string,
|
||||
context->operand->imm.value.s, formatter->imm_padding,
|
||||
formatter->hex_force_leading_number, ZYAN_FALSE);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
ZyanU64 value;
|
||||
ZyanU8 padding = (formatter->imm_padding ==
|
||||
ZYDIS_PADDING_AUTO) ? 0 : (ZyanU8)formatter->imm_padding;
|
||||
switch (context->instruction->operand_width)
|
||||
{
|
||||
case 8:
|
||||
if (formatter->imm_padding == ZYDIS_PADDING_AUTO)
|
||||
{
|
||||
padding = 2;
|
||||
}
|
||||
value = (ZyanU8 )context->operand->imm.value.u;
|
||||
break;
|
||||
case 16:
|
||||
if (formatter->imm_padding == ZYDIS_PADDING_AUTO)
|
||||
{
|
||||
padding = 4;
|
||||
}
|
||||
value = (ZyanU16)context->operand->imm.value.u;
|
||||
break;
|
||||
case 32:
|
||||
if (formatter->imm_padding == ZYDIS_PADDING_AUTO)
|
||||
{
|
||||
padding = 8;
|
||||
}
|
||||
value = (ZyanU32)context->operand->imm.value.u;
|
||||
break;
|
||||
case 64:
|
||||
if (formatter->imm_padding == ZYDIS_PADDING_AUTO)
|
||||
{
|
||||
padding = 16;
|
||||
}
|
||||
value = (ZyanU64)context->operand->imm.value.u;
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->imm_base, &buffer->string, value, padding,
|
||||
formatter->hex_force_leading_number);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Optional tokens */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterBasePrintSegment(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZyanBool printed_segment = ZYAN_FALSE;
|
||||
switch (context->operand->mem.segment)
|
||||
{
|
||||
case ZYDIS_REGISTER_ES:
|
||||
case ZYDIS_REGISTER_CS:
|
||||
case ZYDIS_REGISTER_FS:
|
||||
case ZYDIS_REGISTER_GS:
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->operand->mem.segment));
|
||||
printed_segment = ZYAN_TRUE;
|
||||
break;
|
||||
case ZYDIS_REGISTER_SS:
|
||||
if ((formatter->force_memory_segment) ||
|
||||
(context->instruction->attributes & ZYDIS_ATTRIB_HAS_SEGMENT_SS))
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->operand->mem.segment));
|
||||
printed_segment = ZYAN_TRUE;
|
||||
}
|
||||
break;
|
||||
case ZYDIS_REGISTER_DS:
|
||||
if ((formatter->force_memory_segment) ||
|
||||
(context->instruction->attributes & ZYDIS_ATTRIB_HAS_SEGMENT_DS))
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->operand->mem.segment));
|
||||
printed_segment = ZYAN_TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (printed_segment)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_SEGMENT);
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBasePrintPrefixes(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
if (formatter->detailed_prefixes)
|
||||
{
|
||||
for (ZyanU8 i = 0; i < context->instruction->raw.prefix_count; ++i)
|
||||
{
|
||||
const ZyanU8 value = context->instruction->raw.prefixes[i].value;
|
||||
switch (context->instruction->raw.prefixes[i].type)
|
||||
{
|
||||
case ZYDIS_PREFIX_TYPE_IGNORED:
|
||||
case ZYDIS_PREFIX_TYPE_MANDATORY:
|
||||
{
|
||||
if ((value & 0xF0) == 0x40)
|
||||
{
|
||||
if (buffer->is_token_list)
|
||||
{
|
||||
// TODO: Case
|
||||
ZYAN_CHECK(ZydisFormatterBufferAppendPredefined(buffer,
|
||||
TOK_PREF_REX[value & 0x0F]));
|
||||
} else
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string,
|
||||
STR_PREF_REX[value & 0x0F], formatter->case_prefixes));
|
||||
}
|
||||
} else
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0xF0:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_LOCK, formatter->case_prefixes);
|
||||
break;
|
||||
case 0x2E:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_SEG_CS, formatter->case_prefixes);
|
||||
break;
|
||||
case 0x36:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_SEG_SS, formatter->case_prefixes);
|
||||
break;
|
||||
case 0x3E:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_SEG_DS, formatter->case_prefixes);
|
||||
break;
|
||||
case 0x26:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_SEG_ES, formatter->case_prefixes);
|
||||
break;
|
||||
case 0x64:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_SEG_FS, formatter->case_prefixes);
|
||||
break;
|
||||
case 0x65:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_SEG_GS, formatter->case_prefixes);
|
||||
break;
|
||||
default:
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_PREFIX);
|
||||
ZYAN_CHECK(ZydisStringAppendHexU(&buffer->string, value, 0,
|
||||
formatter->hex_force_leading_number, formatter->hex_uppercase,
|
||||
ZYAN_NULL, ZYAN_NULL));
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_WHITESPACE);
|
||||
ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_WHITESPACE));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ZYDIS_PREFIX_TYPE_EFFECTIVE:
|
||||
switch (value)
|
||||
{
|
||||
case 0xF0:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_LOCK, formatter->case_prefixes);
|
||||
break;
|
||||
case 0xF2:
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_XACQUIRE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_XACQUIRE, formatter->case_prefixes);
|
||||
}
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_REPNE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_REPNE, formatter->case_prefixes);
|
||||
}
|
||||
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_BND)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_BND, formatter->case_prefixes);
|
||||
}
|
||||
break;
|
||||
case 0xF3:
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_XRELEASE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_XRELEASE, formatter->case_prefixes);
|
||||
}
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_REP)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_REP, formatter->case_prefixes);
|
||||
}
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_REPE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_REPE, formatter->case_prefixes);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_XACQUIRE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_XACQUIRE, formatter->case_prefixes);
|
||||
}
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_XRELEASE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_XRELEASE, formatter->case_prefixes);
|
||||
}
|
||||
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_LOCK)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_LOCK, formatter->case_prefixes);
|
||||
}
|
||||
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_BND)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_BND, formatter->case_prefixes);
|
||||
}
|
||||
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_NOTRACK)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_NOTRACK, formatter->case_prefixes);
|
||||
}
|
||||
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_REP)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_REP, formatter->case_prefixes);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_REPE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_REPE, formatter->case_prefixes);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
if (context->instruction->attributes & ZYDIS_ATTRIB_HAS_REPNE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, PREF_REPNE, formatter->case_prefixes);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisDecorator decorator)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
#if defined(ZYDIS_DISABLE_AVX512) && defined(ZYDIS_DISABLE_KNC)
|
||||
ZYAN_UNUSED(formatter);
|
||||
ZYAN_UNUSED(buffer);
|
||||
ZYAN_UNUSED(context);
|
||||
#endif
|
||||
|
||||
switch (decorator)
|
||||
{
|
||||
case ZYDIS_DECORATOR_MASK:
|
||||
{
|
||||
#if !defined(ZYDIS_DISABLE_AVX512) || !defined(ZYDIS_DISABLE_KNC)
|
||||
if (context->instruction->avx.mask.reg != ZYDIS_REGISTER_K0)
|
||||
{
|
||||
if (buffer->is_token_list)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DECO_BEGIN);
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->instruction->avx.mask.reg));
|
||||
ZYDIS_BUFFER_APPEND(buffer, DECO_END);
|
||||
} else
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_DECO_BEGIN));
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->instruction->avx.mask.reg));
|
||||
ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_DECO_END));
|
||||
}
|
||||
|
||||
// Only print the zeroing decorator, if the instruction is not a "zeroing masking only"
|
||||
// instruction (e.g. `vcmpsd`)
|
||||
if ((context->instruction->avx.mask.mode == ZYDIS_MASK_MODE_ZEROING ||
|
||||
context->instruction->avx.mask.mode == ZYDIS_MASK_MODE_CONTROL_ZEROING) &&
|
||||
(context->instruction->raw.evex.z))
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_ZERO, formatter->case_decorators);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case ZYDIS_DECORATOR_BC:
|
||||
#if !defined(ZYDIS_DISABLE_AVX512)
|
||||
if (!context->instruction->avx.broadcast.is_static)
|
||||
{
|
||||
switch (context->instruction->avx.broadcast.mode)
|
||||
{
|
||||
case ZYDIS_BROADCAST_MODE_INVALID:
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_1_TO_2:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_1TO2, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_1_TO_4:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_1TO4, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_1_TO_8:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_1TO8, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_1_TO_16:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_1TO16, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_1_TO_32:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_1TO32, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_1_TO_64:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_1TO64, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_4_TO_8:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_4TO8, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_4_TO_16:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_4TO16, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_8_TO_16:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_8TO16, formatter->case_decorators);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ZYDIS_DECORATOR_RC:
|
||||
#if !defined(ZYDIS_DISABLE_AVX512)
|
||||
if (context->instruction->avx.has_sae)
|
||||
{
|
||||
switch (context->instruction->avx.rounding.mode)
|
||||
{
|
||||
case ZYDIS_ROUNDING_MODE_INVALID:
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RN:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RN_SAE, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RD:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RD_SAE, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RU:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RU_SAE, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RZ:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RZ_SAE, formatter->case_decorators);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
} else
|
||||
{
|
||||
switch (context->instruction->avx.rounding.mode)
|
||||
{
|
||||
case ZYDIS_ROUNDING_MODE_INVALID:
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RN:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RN, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RD:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RD, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RU:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RU, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RZ:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RZ, formatter->case_decorators);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ZYDIS_DECORATOR_SAE:
|
||||
#if !defined(ZYDIS_DISABLE_AVX512)
|
||||
if (context->instruction->avx.has_sae && !context->instruction->avx.rounding.mode)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_SAE, formatter->case_decorators);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ZYDIS_DECORATOR_SWIZZLE:
|
||||
#if !defined(ZYDIS_DISABLE_KNC)
|
||||
switch (context->instruction->avx.swizzle.mode)
|
||||
{
|
||||
case ZYDIS_SWIZZLE_MODE_INVALID:
|
||||
case ZYDIS_SWIZZLE_MODE_DCBA:
|
||||
// Nothing to do here
|
||||
break;
|
||||
case ZYDIS_SWIZZLE_MODE_CDAB:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_CDAB, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_SWIZZLE_MODE_BADC:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_BADC, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_SWIZZLE_MODE_DACB:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DACB, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_SWIZZLE_MODE_AAAA:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_AAAA, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_SWIZZLE_MODE_BBBB:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_BBBB, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_SWIZZLE_MODE_CCCC:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_CCCC, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_SWIZZLE_MODE_DDDD:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DDDD, formatter->case_decorators);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ZYDIS_DECORATOR_CONVERSION:
|
||||
#if !defined(ZYDIS_DISABLE_KNC)
|
||||
switch (context->instruction->avx.conversion.mode)
|
||||
{
|
||||
case ZYDIS_CONVERSION_MODE_INVALID:
|
||||
break;
|
||||
case ZYDIS_CONVERSION_MODE_FLOAT16:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_FLOAT16, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_CONVERSION_MODE_SINT8:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_SINT8, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_CONVERSION_MODE_UINT8:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_UINT8, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_CONVERSION_MODE_SINT16:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_SINT16, formatter->case_decorators);
|
||||
break;
|
||||
case ZYDIS_CONVERSION_MODE_UINT16:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_UINT16, formatter->case_decorators);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ZYDIS_DECORATOR_EH:
|
||||
#if !defined(ZYDIS_DISABLE_KNC)
|
||||
if (context->instruction->avx.has_eviction_hint)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_EH, formatter->case_decorators);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
191
dep/zydis/src/FormatterBuffer.c
Normal file
191
dep/zydis/src/FormatterBuffer.c
Normal file
@ -0,0 +1,191 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Internal/String.h>
|
||||
#include <Zydis/FormatterBuffer.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Token */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterTokenGetValue(const ZydisFormatterToken* token,
|
||||
ZydisTokenType* type, ZyanConstCharPointer* value)
|
||||
{
|
||||
if (!token || !type || !value)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
*type = token->type;
|
||||
*value = (ZyanConstCharPointer)((ZyanU8*)token + sizeof(ZydisFormatterToken));
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterTokenNext(ZydisFormatterTokenConst** token)
|
||||
{
|
||||
if (!token || !*token)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
const ZyanU8 next = (*token)->next;
|
||||
if (!next)
|
||||
{
|
||||
return ZYAN_STATUS_OUT_OF_RANGE;
|
||||
}
|
||||
*token = (ZydisFormatterTokenConst*)((ZyanU8*)*token + sizeof(ZydisFormatterToken) + next);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Buffer */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterBufferGetToken(const ZydisFormatterBuffer* buffer,
|
||||
ZydisFormatterTokenConst** token)
|
||||
{
|
||||
if (!buffer || !token)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
*token = ((ZydisFormatterTokenConst*)buffer->string.vector.data - 1);
|
||||
if ((*token)->type == ZYDIS_TOKEN_INVALID)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBufferGetString(ZydisFormatterBuffer* buffer, ZyanString** string)
|
||||
{
|
||||
if (!buffer || !string)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (buffer->is_token_list &&
|
||||
((ZydisFormatterTokenConst*)buffer->string.vector.data - 1)->type == ZYDIS_TOKEN_INVALID)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
ZYAN_ASSERT(buffer->string.vector.data);
|
||||
ZYAN_ASSERT(buffer->string.vector.size);
|
||||
|
||||
*string = &buffer->string;
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBufferAppend(ZydisFormatterBuffer* buffer, ZydisTokenType type)
|
||||
{
|
||||
if (!buffer)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (!buffer->is_token_list)
|
||||
{
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
const ZyanUSize len = buffer->string.vector.size;
|
||||
ZYAN_ASSERT((len > 0) && (len < 256));
|
||||
if (buffer->capacity <= len + sizeof(ZydisFormatterToken))
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
ZydisFormatterToken* const last = (ZydisFormatterToken*)buffer->string.vector.data - 1;
|
||||
last->next = (ZyanU8)len;
|
||||
|
||||
const ZyanUSize delta = len + sizeof(ZydisFormatterToken);
|
||||
buffer->capacity -= delta;
|
||||
buffer->string.vector.data = (ZyanU8*)buffer->string.vector.data + delta;
|
||||
buffer->string.vector.size = 1;
|
||||
buffer->string.vector.capacity = ZYAN_MIN(buffer->capacity, 255);
|
||||
*(char*)buffer->string.vector.data = '\0';
|
||||
|
||||
ZydisFormatterToken* const token = (ZydisFormatterToken*)buffer->string.vector.data - 1;
|
||||
token->type = type;
|
||||
token->next = 0;
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBufferRemember(const ZydisFormatterBuffer* buffer, ZyanUPointer* state)
|
||||
{
|
||||
if (!buffer || !state)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (buffer->is_token_list)
|
||||
{
|
||||
*state = (ZyanUPointer)buffer->string.vector.data;
|
||||
} else
|
||||
{
|
||||
*state = (ZyanUPointer)buffer->string.vector.size;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterBufferRestore(ZydisFormatterBuffer* buffer, ZyanUPointer state)
|
||||
{
|
||||
if (!buffer)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (buffer->is_token_list)
|
||||
{
|
||||
const ZyanUSize delta = (ZyanUPointer)buffer->string.vector.data - state;
|
||||
buffer->capacity += delta;
|
||||
buffer->string.vector.data = (void*)state;
|
||||
buffer->string.vector.size = 1; // TODO: Restore size?
|
||||
buffer->string.vector.capacity = ZYAN_MIN(buffer->capacity, 255);
|
||||
*(char*)buffer->string.vector.data = '\0';
|
||||
} else
|
||||
{
|
||||
buffer->string.vector.size = (ZyanUSize)state;
|
||||
ZYDIS_STRING_NULLTERMINATE(&buffer->string);
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
455
dep/zydis/src/FormatterIntel.c
Normal file
455
dep/zydis/src/FormatterIntel.c
Normal file
@ -0,0 +1,455 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd, Joel Hoener
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Internal/FormatterIntel.h>
|
||||
#include <Zydis/Utils.h>
|
||||
#include <Zycore/Format.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Constants */
|
||||
/* ============================================================================================== */
|
||||
|
||||
#include <Generated/FormatterStrings.inc>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Formatter functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Intel */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterIntelFormatInstruction(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
ZYAN_ASSERT(context->instruction);
|
||||
ZYAN_ASSERT(context->operands);
|
||||
|
||||
ZYAN_CHECK(formatter->func_print_prefixes(formatter, buffer, context));
|
||||
ZYAN_CHECK(formatter->func_print_mnemonic(formatter, buffer, context));
|
||||
|
||||
ZyanUPointer state_mnemonic;
|
||||
ZYDIS_BUFFER_REMEMBER(buffer, state_mnemonic);
|
||||
for (ZyanU8 i = 0; i < context->instruction->operand_count_visible; ++i)
|
||||
{
|
||||
const ZydisDecodedOperand* const operand = &context->operands[i];
|
||||
|
||||
// Print embedded-mask registers as decorator instead of a regular operand
|
||||
if ((i == 1) && (operand->type == ZYDIS_OPERAND_TYPE_REGISTER) &&
|
||||
(operand->encoding == ZYDIS_OPERAND_ENCODING_MASK))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ZyanUPointer buffer_state;
|
||||
ZYDIS_BUFFER_REMEMBER(buffer, buffer_state);
|
||||
|
||||
if (buffer_state != state_mnemonic)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_OPERAND);
|
||||
} else
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_MNEMONIC);
|
||||
}
|
||||
|
||||
// Set current operand
|
||||
context->operand = operand;
|
||||
|
||||
ZyanStatus status;
|
||||
if (formatter->func_pre_operand)
|
||||
{
|
||||
status = formatter->func_pre_operand(formatter, buffer, context);
|
||||
if (status == ZYDIS_STATUS_SKIP_TOKEN)
|
||||
{
|
||||
ZYAN_CHECK(ZydisFormatterBufferRestore(buffer, buffer_state));
|
||||
continue;
|
||||
}
|
||||
if (!ZYAN_SUCCESS(status))
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
switch (operand->type)
|
||||
{
|
||||
case ZYDIS_OPERAND_TYPE_REGISTER:
|
||||
status = formatter->func_format_operand_reg(formatter, buffer, context);
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||
status = formatter->func_format_operand_mem(formatter, buffer, context);
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_POINTER:
|
||||
status = formatter->func_format_operand_ptr(formatter, buffer, context);
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||
status = formatter->func_format_operand_imm(formatter, buffer, context);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
if (status == ZYDIS_STATUS_SKIP_TOKEN)
|
||||
{
|
||||
ZYAN_CHECK(ZydisFormatterBufferRestore(buffer, buffer_state));
|
||||
continue;
|
||||
}
|
||||
if (!ZYAN_SUCCESS(status))
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
if (formatter->func_post_operand)
|
||||
{
|
||||
status = formatter->func_post_operand(formatter, buffer, context);
|
||||
if (status == ZYDIS_STATUS_SKIP_TOKEN)
|
||||
{
|
||||
ZYAN_CHECK(ZydisFormatterBufferRestore(buffer, buffer_state));
|
||||
continue;
|
||||
}
|
||||
if (ZYAN_SUCCESS(status))
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(ZYDIS_DISABLE_AVX512) || !defined(ZYDIS_DISABLE_KNC)
|
||||
if ((context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX) ||
|
||||
(context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX))
|
||||
{
|
||||
if ((i == 0) &&
|
||||
(context->instruction->operand_count_visible > 1) &&
|
||||
(context->operands[i + 1].encoding == ZYDIS_OPERAND_ENCODING_MASK))
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_MASK));
|
||||
}
|
||||
if (operand->type == ZYDIS_OPERAND_TYPE_MEMORY)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_BC));
|
||||
if (context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_CONVERSION));
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_EH));
|
||||
}
|
||||
} else
|
||||
{
|
||||
ZyanBool decorate_operand;
|
||||
if (i == (context->instruction->operand_count_visible - 1))
|
||||
{
|
||||
decorate_operand = operand->type != ZYDIS_OPERAND_TYPE_IMMEDIATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
decorate_operand =
|
||||
(context->instruction->operand_count_visible > (i + 1)) &&
|
||||
((context->operands[i + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE) ||
|
||||
(context->operands[i + 1].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN));
|
||||
}
|
||||
if (decorate_operand)
|
||||
{
|
||||
if (context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_SWIZZLE));
|
||||
}
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_RC));
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_SAE));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterIntelFormatOperandMEM(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
if ((context->operand->mem.type == ZYDIS_MEMOP_TYPE_MEM) ||
|
||||
(context->operand->mem.type == ZYDIS_MEMOP_TYPE_VSIB))
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_typecast(formatter, buffer, context));
|
||||
}
|
||||
ZYAN_CHECK(formatter->func_print_segment(formatter, buffer, context));
|
||||
|
||||
ZYDIS_BUFFER_APPEND(buffer, MEMORY_BEGIN_INTEL);
|
||||
|
||||
const ZyanBool absolute = !formatter->force_relative_riprel &&
|
||||
(context->runtime_address != ZYDIS_RUNTIME_ADDRESS_NONE);
|
||||
if (absolute && context->operand->mem.disp.has_displacement &&
|
||||
(context->operand->mem.index == ZYDIS_REGISTER_NONE) &&
|
||||
((context->operand->mem.base == ZYDIS_REGISTER_NONE) ||
|
||||
(context->operand->mem.base == ZYDIS_REGISTER_EIP ) ||
|
||||
(context->operand->mem.base == ZYDIS_REGISTER_RIP )))
|
||||
{
|
||||
// EIP/RIP-relative or absolute-displacement address operand
|
||||
ZYAN_CHECK(formatter->func_print_address_abs(formatter, buffer, context));
|
||||
} else
|
||||
{
|
||||
const ZyanBool should_print_reg = context->operand->mem.base != ZYDIS_REGISTER_NONE;
|
||||
const ZyanBool should_print_idx = context->operand->mem.index != ZYDIS_REGISTER_NONE;
|
||||
const ZyanBool neither_reg_nor_idx = !should_print_reg && !should_print_idx;
|
||||
|
||||
// Regular memory operand
|
||||
if (should_print_reg)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->operand->mem.base));
|
||||
}
|
||||
if (should_print_idx)
|
||||
{
|
||||
if (context->operand->mem.base != ZYDIS_REGISTER_NONE)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, ADD);
|
||||
}
|
||||
ZYAN_CHECK(formatter->func_print_register(formatter, buffer, context,
|
||||
context->operand->mem.index));
|
||||
if (context->operand->mem.scale &&
|
||||
(context->operand->mem.type != ZYDIS_MEMOP_TYPE_MIB) &&
|
||||
((context->operand->mem.scale > 1) || formatter->force_memory_scale))
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, MUL);
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
|
||||
ZYAN_CHECK(ZydisStringAppendDecU(&buffer->string, context->operand->mem.scale, 0,
|
||||
ZYAN_NULL, ZYAN_NULL));
|
||||
}
|
||||
}
|
||||
if (neither_reg_nor_idx)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_address_abs(formatter, buffer, context));
|
||||
} else if (context->operand->mem.disp.has_displacement && context->operand->mem.disp.value)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_disp(formatter, buffer, context));
|
||||
}
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND(buffer, MEMORY_END_INTEL);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterIntelPrintMnemonic(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
const ZydisShortString* mnemonic = ZydisMnemonicGetStringWrapped(
|
||||
context->instruction->mnemonic);
|
||||
if (!mnemonic)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, INVALID_MNEMONIC, formatter->case_mnemonic);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_MNEMONIC);
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, mnemonic, formatter->case_mnemonic));
|
||||
if (context->instruction->meta.branch_type == ZYDIS_BRANCH_TYPE_FAR)
|
||||
{
|
||||
return ZydisStringAppendShortCase(&buffer->string, &STR_FAR, formatter->case_mnemonic);
|
||||
}
|
||||
if (formatter->print_branch_size)
|
||||
{
|
||||
switch (context->instruction->meta.branch_type)
|
||||
{
|
||||
case ZYDIS_BRANCH_TYPE_NONE:
|
||||
break;
|
||||
case ZYDIS_BRANCH_TYPE_SHORT:
|
||||
return ZydisStringAppendShortCase(&buffer->string, &STR_SHORT,
|
||||
formatter->case_mnemonic);
|
||||
case ZYDIS_BRANCH_TYPE_NEAR:
|
||||
return ZydisStringAppendShortCase(&buffer->string, &STR_NEAR,
|
||||
formatter->case_mnemonic);
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterIntelPrintRegister(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisRegister reg)
|
||||
{
|
||||
ZYAN_UNUSED(context);
|
||||
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
const ZydisShortString* str = ZydisRegisterGetStringWrapped(reg);
|
||||
if (!str)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, INVALID_REG, formatter->case_registers);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_REGISTER);
|
||||
return ZydisStringAppendShortCase(&buffer->string, str, formatter->case_registers);
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterIntelPrintDISP(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
switch (formatter->disp_signedness)
|
||||
{
|
||||
case ZYDIS_SIGNEDNESS_AUTO:
|
||||
case ZYDIS_SIGNEDNESS_SIGNED:
|
||||
if (context->operand->mem.disp.value < 0)
|
||||
{
|
||||
if ((context->operand->mem.base != ZYDIS_REGISTER_NONE) ||
|
||||
(context->operand->mem.index != ZYDIS_REGISTER_NONE))
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, SUB);
|
||||
}
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_DISPLACEMENT);
|
||||
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->disp_base, &buffer->string,
|
||||
ZyanAbsI64(context->operand->mem.disp.value), formatter->disp_padding,
|
||||
formatter->hex_force_leading_number);
|
||||
break;
|
||||
}
|
||||
ZYAN_FALLTHROUGH;
|
||||
case ZYDIS_SIGNEDNESS_UNSIGNED:
|
||||
if ((context->operand->mem.base != ZYDIS_REGISTER_NONE) ||
|
||||
(context->operand->mem.index != ZYDIS_REGISTER_NONE))
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, ADD);
|
||||
}
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_DISPLACEMENT);
|
||||
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->disp_base, &buffer->string,
|
||||
context->operand->mem.disp.value, formatter->disp_padding,
|
||||
formatter->hex_force_leading_number);
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterIntelPrintTypecast(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
switch (ZydisFormatterHelperGetExplicitSize(formatter, context, context->operand))
|
||||
{
|
||||
case 8: ZYDIS_BUFFER_APPEND(buffer, SIZE_8_INTEL ); break;
|
||||
case 16: ZYDIS_BUFFER_APPEND(buffer, SIZE_16_INTEL ); break;
|
||||
case 32: ZYDIS_BUFFER_APPEND(buffer, SIZE_32_INTEL ); break;
|
||||
case 48: ZYDIS_BUFFER_APPEND(buffer, SIZE_48 ); break;
|
||||
case 64: ZYDIS_BUFFER_APPEND(buffer, SIZE_64_INTEL ); break;
|
||||
case 80: ZYDIS_BUFFER_APPEND(buffer, SIZE_80 ); break;
|
||||
case 128: ZYDIS_BUFFER_APPEND(buffer, SIZE_128_INTEL); break;
|
||||
case 256: ZYDIS_BUFFER_APPEND(buffer, SIZE_256_INTEL); break;
|
||||
case 512: ZYDIS_BUFFER_APPEND(buffer, SIZE_512_INTEL); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* MASM */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisFormatterIntelFormatInstructionMASM(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
// Force the formatter to always call our MASM `ZYDIS_FORMATTER_PRINT_ADDRESS_ABS` function.
|
||||
// This implicitly omits printing of the `RIP`/`EIP` registers for `RIP`/`EIP`-relative
|
||||
// memory operands
|
||||
context->runtime_address = 0;
|
||||
|
||||
return ZydisFormatterIntelFormatInstruction(formatter, buffer, context);
|
||||
}
|
||||
|
||||
ZyanStatus ZydisFormatterIntelPrintAddressMASM(const ZydisFormatter* formatter,
|
||||
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context)
|
||||
{
|
||||
ZYAN_ASSERT(formatter);
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
ZyanU64 address;
|
||||
ZYAN_CHECK(ZydisCalcAbsoluteAddress(context->instruction, context->operand, 0, &address));
|
||||
|
||||
ZyanU8 padding = (formatter->addr_padding_relative ==
|
||||
ZYDIS_PADDING_AUTO) ? 0 : (ZyanU8)formatter->addr_padding_relative;
|
||||
if ((formatter->addr_padding_relative == ZYDIS_PADDING_AUTO) &&
|
||||
(formatter->addr_base == ZYDIS_NUMERIC_BASE_HEX))
|
||||
{
|
||||
switch (context->instruction->stack_width)
|
||||
{
|
||||
case 16:
|
||||
padding = 4;
|
||||
address = (ZyanU16)address;
|
||||
break;
|
||||
case 32:
|
||||
padding = 8;
|
||||
address = (ZyanU32)address;
|
||||
break;
|
||||
case 64:
|
||||
padding = 16;
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
ZYDIS_BUFFER_APPEND(buffer, ADDR_RELATIVE);
|
||||
ZYDIS_STRING_APPEND_NUM_S(formatter, formatter->addr_base, &buffer->string, address, padding,
|
||||
formatter->hex_force_leading_number, ZYAN_TRUE);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
78
dep/zydis/src/Generated/AccessedFlags.inc
Normal file
78
dep/zydis/src/Generated/AccessedFlags.inc
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef ZYDIS_MINIMAL_MODE
|
||||
static const ZydisDefinitionAccessedFlags ACCESSED_FLAGS[] =
|
||||
{
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0xF, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x6, 0x0, 0x0, 0x9 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0xF } },
|
||||
{ { 0x0, 0x0, 0x40000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x40000, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1000, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x800, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x800, 0x800, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x400, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1400, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x400, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x400, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1000, 0x80200, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x30200, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x21800, 0x64300, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x21000, 0xE4200, 0x10100, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x80, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x880, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x40, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x40, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0x8C0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x40, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x4, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x4, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0x0, 0x8D4, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0x41, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x41, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0xD5, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x3F5FD5, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x1, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x1, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x11, 0xD5, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x8C5, 0x0, 0x0, 0x10 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x1, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x1, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x41, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x440, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x400, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x25000, 0x3F5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x21000, 0x3D5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x121000, 0x2C5FD5, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x3F5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x3C5FD5, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x3C5FD5, 0x30000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x45, 0x890, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x45, 0x890, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC5, 0x0, 0x0, 0x810 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x8C1, 0x14, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x41, 0x894, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x1, 0x8D4, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x10, 0x11, 0x0, 0x0, 0x8C4 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x1, 0x0, 0x0, 0x894 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC1, 0x800, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x41, 0x0, 0x0, 0x894 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x81, 0x840, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x801, 0x0, 0x0, 0xD4 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x1, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC4, 0x801, 0x0, 0x10 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x40, 0x895, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x8D5, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC0, 0x801, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x40, 0x801, 0x0, 0x94 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x1, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC4, 0x0, 0x0, 0x811 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x40, 0x0, 0x0, 0x895 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x8D5 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
};
|
||||
#endif
|
7585
dep/zydis/src/Generated/DecoderTables.inc
Normal file
7585
dep/zydis/src/Generated/DecoderTables.inc
Normal file
File diff suppressed because one or more lines are too long
92
dep/zydis/src/Generated/EnumISAExt.inc
Normal file
92
dep/zydis/src/Generated/EnumISAExt.inc
Normal file
@ -0,0 +1,92 @@
|
||||
static const char* STR_ISAEXT[] =
|
||||
{
|
||||
"INVALID",
|
||||
"ADOX_ADCX",
|
||||
"AES",
|
||||
"AMD3DNOW",
|
||||
"AMD3DNOW_PREFETCH",
|
||||
"AMD_INVLPGB",
|
||||
"AMX_BF16",
|
||||
"AMX_INT8",
|
||||
"AMX_TILE",
|
||||
"AVX",
|
||||
"AVX2",
|
||||
"AVX2GATHER",
|
||||
"AVX512EVEX",
|
||||
"AVX512VEX",
|
||||
"AVXAES",
|
||||
"AVX_VNNI",
|
||||
"BASE",
|
||||
"BMI1",
|
||||
"BMI2",
|
||||
"CET",
|
||||
"CLDEMOTE",
|
||||
"CLFLUSHOPT",
|
||||
"CLFSH",
|
||||
"CLWB",
|
||||
"CLZERO",
|
||||
"ENQCMD",
|
||||
"F16C",
|
||||
"FMA",
|
||||
"FMA4",
|
||||
"GFNI",
|
||||
"HRESET",
|
||||
"INVPCID",
|
||||
"KEYLOCKER",
|
||||
"KEYLOCKER_WIDE",
|
||||
"KNC",
|
||||
"KNCE",
|
||||
"KNCV",
|
||||
"LONGMODE",
|
||||
"LZCNT",
|
||||
"MCOMMIT",
|
||||
"MMX",
|
||||
"MONITOR",
|
||||
"MONITORX",
|
||||
"MOVBE",
|
||||
"MOVDIR",
|
||||
"MPX",
|
||||
"PADLOCK",
|
||||
"PAUSE",
|
||||
"PCLMULQDQ",
|
||||
"PCONFIG",
|
||||
"PKU",
|
||||
"PREFETCHWT1",
|
||||
"PT",
|
||||
"RDPID",
|
||||
"RDPRU",
|
||||
"RDRAND",
|
||||
"RDSEED",
|
||||
"RDTSCP",
|
||||
"RDWRFSGS",
|
||||
"RTM",
|
||||
"SERIALIZE",
|
||||
"SGX",
|
||||
"SGX_ENCLV",
|
||||
"SHA",
|
||||
"SMAP",
|
||||
"SMX",
|
||||
"SNP",
|
||||
"SSE",
|
||||
"SSE2",
|
||||
"SSE3",
|
||||
"SSE4",
|
||||
"SSE4A",
|
||||
"SSSE3",
|
||||
"SVM",
|
||||
"TBM",
|
||||
"TDX",
|
||||
"TSX_LDTRK",
|
||||
"UINTR",
|
||||
"VAES",
|
||||
"VMFUNC",
|
||||
"VPCLMULQDQ",
|
||||
"VTX",
|
||||
"WAITPKG",
|
||||
"X87",
|
||||
"XOP",
|
||||
"XSAVE",
|
||||
"XSAVEC",
|
||||
"XSAVEOPT",
|
||||
"XSAVES"
|
||||
};
|
186
dep/zydis/src/Generated/EnumISASet.inc
Normal file
186
dep/zydis/src/Generated/EnumISASet.inc
Normal file
@ -0,0 +1,186 @@
|
||||
static const char* STR_ISASET[] =
|
||||
{
|
||||
"INVALID",
|
||||
"ADOX_ADCX",
|
||||
"AES",
|
||||
"AMD",
|
||||
"AMD3DNOW",
|
||||
"AMD_INVLPGB",
|
||||
"AMX_BF16",
|
||||
"AMX_INT8",
|
||||
"AMX_TILE",
|
||||
"AVX",
|
||||
"AVX2",
|
||||
"AVX2GATHER",
|
||||
"AVX512BW_128",
|
||||
"AVX512BW_128N",
|
||||
"AVX512BW_256",
|
||||
"AVX512BW_512",
|
||||
"AVX512BW_KOP",
|
||||
"AVX512CD_128",
|
||||
"AVX512CD_256",
|
||||
"AVX512CD_512",
|
||||
"AVX512DQ_128",
|
||||
"AVX512DQ_128N",
|
||||
"AVX512DQ_256",
|
||||
"AVX512DQ_512",
|
||||
"AVX512DQ_KOP",
|
||||
"AVX512DQ_SCALAR",
|
||||
"AVX512ER_512",
|
||||
"AVX512ER_SCALAR",
|
||||
"AVX512F_128",
|
||||
"AVX512F_128N",
|
||||
"AVX512F_256",
|
||||
"AVX512F_512",
|
||||
"AVX512F_KOP",
|
||||
"AVX512F_SCALAR",
|
||||
"AVX512PF_512",
|
||||
"AVX512_4FMAPS_512",
|
||||
"AVX512_4FMAPS_SCALAR",
|
||||
"AVX512_4VNNIW_512",
|
||||
"AVX512_BF16_128",
|
||||
"AVX512_BF16_256",
|
||||
"AVX512_BF16_512",
|
||||
"AVX512_BITALG_128",
|
||||
"AVX512_BITALG_256",
|
||||
"AVX512_BITALG_512",
|
||||
"AVX512_FP16_128",
|
||||
"AVX512_FP16_128N",
|
||||
"AVX512_FP16_256",
|
||||
"AVX512_FP16_512",
|
||||
"AVX512_FP16_SCALAR",
|
||||
"AVX512_GFNI_128",
|
||||
"AVX512_GFNI_256",
|
||||
"AVX512_GFNI_512",
|
||||
"AVX512_IFMA_128",
|
||||
"AVX512_IFMA_256",
|
||||
"AVX512_IFMA_512",
|
||||
"AVX512_VAES_128",
|
||||
"AVX512_VAES_256",
|
||||
"AVX512_VAES_512",
|
||||
"AVX512_VBMI2_128",
|
||||
"AVX512_VBMI2_256",
|
||||
"AVX512_VBMI2_512",
|
||||
"AVX512_VBMI_128",
|
||||
"AVX512_VBMI_256",
|
||||
"AVX512_VBMI_512",
|
||||
"AVX512_VNNI_128",
|
||||
"AVX512_VNNI_256",
|
||||
"AVX512_VNNI_512",
|
||||
"AVX512_VP2INTERSECT_128",
|
||||
"AVX512_VP2INTERSECT_256",
|
||||
"AVX512_VP2INTERSECT_512",
|
||||
"AVX512_VPCLMULQDQ_128",
|
||||
"AVX512_VPCLMULQDQ_256",
|
||||
"AVX512_VPCLMULQDQ_512",
|
||||
"AVX512_VPOPCNTDQ_128",
|
||||
"AVX512_VPOPCNTDQ_256",
|
||||
"AVX512_VPOPCNTDQ_512",
|
||||
"AVXAES",
|
||||
"AVX_GFNI",
|
||||
"AVX_VNNI",
|
||||
"BMI1",
|
||||
"BMI2",
|
||||
"CET",
|
||||
"CLDEMOTE",
|
||||
"CLFLUSHOPT",
|
||||
"CLFSH",
|
||||
"CLWB",
|
||||
"CLZERO",
|
||||
"CMOV",
|
||||
"CMPXCHG16B",
|
||||
"ENQCMD",
|
||||
"F16C",
|
||||
"FAT_NOP",
|
||||
"FCMOV",
|
||||
"FMA",
|
||||
"FMA4",
|
||||
"FXSAVE",
|
||||
"FXSAVE64",
|
||||
"GFNI",
|
||||
"HRESET",
|
||||
"I186",
|
||||
"I286PROTECTED",
|
||||
"I286REAL",
|
||||
"I386",
|
||||
"I486",
|
||||
"I486REAL",
|
||||
"I86",
|
||||
"INVPCID",
|
||||
"KEYLOCKER",
|
||||
"KEYLOCKER_WIDE",
|
||||
"KNCE",
|
||||
"KNCJKBR",
|
||||
"KNCSTREAM",
|
||||
"KNCV",
|
||||
"KNC_MISC",
|
||||
"KNC_PF_HINT",
|
||||
"LAHF",
|
||||
"LONGMODE",
|
||||
"LWP",
|
||||
"LZCNT",
|
||||
"MCOMMIT",
|
||||
"MONITOR",
|
||||
"MONITORX",
|
||||
"MOVBE",
|
||||
"MOVDIR",
|
||||
"MPX",
|
||||
"PADLOCK_ACE",
|
||||
"PADLOCK_PHE",
|
||||
"PADLOCK_PMM",
|
||||
"PADLOCK_RNG",
|
||||
"PAUSE",
|
||||
"PCLMULQDQ",
|
||||
"PCONFIG",
|
||||
"PENTIUMMMX",
|
||||
"PENTIUMREAL",
|
||||
"PKU",
|
||||
"POPCNT",
|
||||
"PPRO",
|
||||
"PREFETCHWT1",
|
||||
"PREFETCH_NOP",
|
||||
"PT",
|
||||
"RDPID",
|
||||
"RDPMC",
|
||||
"RDPRU",
|
||||
"RDRAND",
|
||||
"RDSEED",
|
||||
"RDTSCP",
|
||||
"RDWRFSGS",
|
||||
"RTM",
|
||||
"SERIALIZE",
|
||||
"SGX",
|
||||
"SGX_ENCLV",
|
||||
"SHA",
|
||||
"SMAP",
|
||||
"SMX",
|
||||
"SNP",
|
||||
"SSE",
|
||||
"SSE2",
|
||||
"SSE2MMX",
|
||||
"SSE3",
|
||||
"SSE3X87",
|
||||
"SSE4",
|
||||
"SSE42",
|
||||
"SSE4A",
|
||||
"SSEMXCSR",
|
||||
"SSE_PREFETCH",
|
||||
"SSSE3",
|
||||
"SSSE3MMX",
|
||||
"SVM",
|
||||
"TBM",
|
||||
"TDX",
|
||||
"TSX_LDTRK",
|
||||
"UINTR",
|
||||
"VAES",
|
||||
"VMFUNC",
|
||||
"VPCLMULQDQ",
|
||||
"VTX",
|
||||
"WAITPKG",
|
||||
"X87",
|
||||
"XOP",
|
||||
"XSAVE",
|
||||
"XSAVEC",
|
||||
"XSAVEOPT",
|
||||
"XSAVES"
|
||||
};
|
112
dep/zydis/src/Generated/EnumInstructionCategory.inc
Normal file
112
dep/zydis/src/Generated/EnumInstructionCategory.inc
Normal file
@ -0,0 +1,112 @@
|
||||
static const char* STR_INSTRUCTIONCATEGORY[] =
|
||||
{
|
||||
"INVALID",
|
||||
"ADOX_ADCX",
|
||||
"AES",
|
||||
"AMD3DNOW",
|
||||
"AMX_TILE",
|
||||
"AVX",
|
||||
"AVX2",
|
||||
"AVX2GATHER",
|
||||
"AVX512",
|
||||
"AVX512_4FMAPS",
|
||||
"AVX512_4VNNIW",
|
||||
"AVX512_BITALG",
|
||||
"AVX512_VBMI",
|
||||
"AVX512_VP2INTERSECT",
|
||||
"BINARY",
|
||||
"BITBYTE",
|
||||
"BLEND",
|
||||
"BMI1",
|
||||
"BMI2",
|
||||
"BROADCAST",
|
||||
"CALL",
|
||||
"CET",
|
||||
"CLDEMOTE",
|
||||
"CLFLUSHOPT",
|
||||
"CLWB",
|
||||
"CLZERO",
|
||||
"CMOV",
|
||||
"COMPRESS",
|
||||
"COND_BR",
|
||||
"CONFLICT",
|
||||
"CONVERT",
|
||||
"DATAXFER",
|
||||
"DECIMAL",
|
||||
"ENQCMD",
|
||||
"EXPAND",
|
||||
"FCMOV",
|
||||
"FLAGOP",
|
||||
"FMA4",
|
||||
"FP16",
|
||||
"GATHER",
|
||||
"GFNI",
|
||||
"HRESET",
|
||||
"IFMA",
|
||||
"INTERRUPT",
|
||||
"IO",
|
||||
"IOSTRINGOP",
|
||||
"KEYLOCKER",
|
||||
"KEYLOCKER_WIDE",
|
||||
"KMASK",
|
||||
"KNC",
|
||||
"KNCMASK",
|
||||
"KNCSCALAR",
|
||||
"LEGACY",
|
||||
"LOGICAL",
|
||||
"LOGICAL_FP",
|
||||
"LZCNT",
|
||||
"MISC",
|
||||
"MMX",
|
||||
"MOVDIR",
|
||||
"MPX",
|
||||
"NOP",
|
||||
"PADLOCK",
|
||||
"PCLMULQDQ",
|
||||
"PCONFIG",
|
||||
"PKU",
|
||||
"POP",
|
||||
"PREFETCH",
|
||||
"PREFETCHWT1",
|
||||
"PT",
|
||||
"PUSH",
|
||||
"RDPID",
|
||||
"RDPRU",
|
||||
"RDRAND",
|
||||
"RDSEED",
|
||||
"RDWRFSGS",
|
||||
"RET",
|
||||
"ROTATE",
|
||||
"SCATTER",
|
||||
"SEGOP",
|
||||
"SEMAPHORE",
|
||||
"SERIALIZE",
|
||||
"SETCC",
|
||||
"SGX",
|
||||
"SHA",
|
||||
"SHIFT",
|
||||
"SMAP",
|
||||
"SSE",
|
||||
"STRINGOP",
|
||||
"STTNI",
|
||||
"SYSCALL",
|
||||
"SYSRET",
|
||||
"SYSTEM",
|
||||
"TBM",
|
||||
"TSX_LDTRK",
|
||||
"UFMA",
|
||||
"UINTR",
|
||||
"UNCOND_BR",
|
||||
"VAES",
|
||||
"VBMI2",
|
||||
"VEX",
|
||||
"VFMA",
|
||||
"VPCLMULQDQ",
|
||||
"VTX",
|
||||
"WAITPKG",
|
||||
"WIDENOP",
|
||||
"X87_ALU",
|
||||
"XOP",
|
||||
"XSAVE",
|
||||
"XSAVEOPT"
|
||||
};
|
1758
dep/zydis/src/Generated/EnumMnemonic.inc
Normal file
1758
dep/zydis/src/Generated/EnumMnemonic.inc
Normal file
File diff suppressed because it is too large
Load Diff
289
dep/zydis/src/Generated/EnumRegister.inc
Normal file
289
dep/zydis/src/Generated/EnumRegister.inc
Normal file
@ -0,0 +1,289 @@
|
||||
static const ZydisShortString STR_REGISTERS[] =
|
||||
{
|
||||
ZYDIS_MAKE_SHORTSTRING("none"),
|
||||
// General purpose registers 8-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("al"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ah"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ch"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dh"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bh"),
|
||||
ZYDIS_MAKE_SHORTSTRING("spl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bpl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("sil"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dil"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r8b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r9b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r10b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r11b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r12b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r13b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r14b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r15b"),
|
||||
// General purpose registers 16-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("ax"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("sp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("si"),
|
||||
ZYDIS_MAKE_SHORTSTRING("di"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r8w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r9w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r10w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r11w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r12w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r13w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r14w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r15w"),
|
||||
// General purpose registers 32-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("eax"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ecx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("edx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ebx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("esp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ebp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("esi"),
|
||||
ZYDIS_MAKE_SHORTSTRING("edi"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r8d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r9d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r10d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r11d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r12d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r13d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r14d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r15d"),
|
||||
// General purpose registers 64-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("rax"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rcx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rdx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rbx"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rsp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rbp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rsi"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rdi"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r8"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r9"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r10"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r11"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r12"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r13"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r14"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r15"),
|
||||
// Floating point legacy registers
|
||||
ZYDIS_MAKE_SHORTSTRING("st0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("st1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("st2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("st3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("st4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("st5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("st6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("st7"),
|
||||
ZYDIS_MAKE_SHORTSTRING("x87control"),
|
||||
ZYDIS_MAKE_SHORTSTRING("x87status"),
|
||||
ZYDIS_MAKE_SHORTSTRING("x87tag"),
|
||||
// Floating point multimedia registers
|
||||
ZYDIS_MAKE_SHORTSTRING("mm0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("mm1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("mm2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("mm3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("mm4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("mm5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("mm6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("mm7"),
|
||||
// Floating point vector registers 128-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm7"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm8"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm9"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm10"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm11"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm12"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm13"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm14"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm15"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm16"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm17"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm18"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm19"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm20"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm21"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm22"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm23"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm24"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm25"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm26"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm27"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm28"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm29"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm30"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xmm31"),
|
||||
// Floating point vector registers 256-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm7"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm8"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm9"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm10"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm11"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm12"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm13"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm14"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm15"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm16"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm17"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm18"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm19"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm20"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm21"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm22"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm23"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm24"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm25"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm26"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm27"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm28"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm29"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm30"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ymm31"),
|
||||
// Floating point vector registers 512-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm7"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm8"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm9"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm10"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm11"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm12"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm13"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm14"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm15"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm16"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm17"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm18"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm19"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm20"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm21"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm22"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm23"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm24"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm25"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm26"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm27"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm28"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm29"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm30"),
|
||||
ZYDIS_MAKE_SHORTSTRING("zmm31"),
|
||||
// Matrix registers
|
||||
ZYDIS_MAKE_SHORTSTRING("tmm0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tmm1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tmm2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tmm3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tmm4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tmm5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tmm6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tmm7"),
|
||||
// Flags registers
|
||||
ZYDIS_MAKE_SHORTSTRING("flags"),
|
||||
ZYDIS_MAKE_SHORTSTRING("eflags"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rflags"),
|
||||
// Instruction-pointer registers
|
||||
ZYDIS_MAKE_SHORTSTRING("ip"),
|
||||
ZYDIS_MAKE_SHORTSTRING("eip"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rip"),
|
||||
// Segment registers
|
||||
ZYDIS_MAKE_SHORTSTRING("es"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cs"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ss"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ds"),
|
||||
ZYDIS_MAKE_SHORTSTRING("fs"),
|
||||
ZYDIS_MAKE_SHORTSTRING("gs"),
|
||||
// Table registers
|
||||
ZYDIS_MAKE_SHORTSTRING("gdtr"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ldtr"),
|
||||
ZYDIS_MAKE_SHORTSTRING("idtr"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tr"),
|
||||
// Test registers
|
||||
ZYDIS_MAKE_SHORTSTRING("tr0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tr1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tr2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tr3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tr4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tr5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tr6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("tr7"),
|
||||
// Control registers
|
||||
ZYDIS_MAKE_SHORTSTRING("cr0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr7"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr8"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr9"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr10"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr11"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr12"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr13"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr14"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cr15"),
|
||||
// Debug registers
|
||||
ZYDIS_MAKE_SHORTSTRING("dr0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr7"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr8"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr9"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr10"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr11"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr12"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr13"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr14"),
|
||||
ZYDIS_MAKE_SHORTSTRING("dr15"),
|
||||
// Mask registers
|
||||
ZYDIS_MAKE_SHORTSTRING("k0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("k1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("k2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("k3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("k4"),
|
||||
ZYDIS_MAKE_SHORTSTRING("k5"),
|
||||
ZYDIS_MAKE_SHORTSTRING("k6"),
|
||||
ZYDIS_MAKE_SHORTSTRING("k7"),
|
||||
// Bound registers
|
||||
ZYDIS_MAKE_SHORTSTRING("bnd0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bnd1"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bnd2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bnd3"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bndcfg"),
|
||||
ZYDIS_MAKE_SHORTSTRING("bndstatus"),
|
||||
// Uncategorized
|
||||
ZYDIS_MAKE_SHORTSTRING("mxcsr"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pkru"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xcr0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("uif")
|
||||
};
|
816
dep/zydis/src/Generated/FormatterStrings.inc
Normal file
816
dep/zydis/src/Generated/FormatterStrings.inc
Normal file
@ -0,0 +1,816 @@
|
||||
#pragma pack(push, 1)
|
||||
|
||||
static const ZydisShortString STR_ADD = ZYDIS_MAKE_SHORTSTRING("+");
|
||||
static const struct ZydisPredefinedTokenADD_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_ADD = { 4, 2, { ZYDIS_TOKEN_DELIMITER, 0, '+', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_ADD = (const ZydisPredefinedToken* const)&TOK_DATA_ADD;
|
||||
|
||||
static const ZydisShortString STR_ADDR_RELATIVE = ZYDIS_MAKE_SHORTSTRING("$");
|
||||
static const struct ZydisPredefinedTokenADDR_RELATIVE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_ADDR_RELATIVE = { 4, 2, { ZYDIS_TOKEN_ADDRESS_REL, 0, '$', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_ADDR_RELATIVE = (const ZydisPredefinedToken* const)&TOK_DATA_ADDR_RELATIVE;
|
||||
|
||||
static const ZydisShortString STR_DECO_1TO2 = ZYDIS_MAKE_SHORTSTRING(" {1to2}");
|
||||
static const struct ZydisPredefinedTokenDECO_1TO2_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_1TO2 = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, '1', 't', 'o', '2', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_1TO2 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_1TO2;
|
||||
|
||||
static const ZydisShortString STR_DECO_1TO4 = ZYDIS_MAKE_SHORTSTRING(" {1to4}");
|
||||
static const struct ZydisPredefinedTokenDECO_1TO4_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_1TO4 = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, '1', 't', 'o', '4', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_1TO4 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_1TO4;
|
||||
|
||||
static const ZydisShortString STR_DECO_1TO8 = ZYDIS_MAKE_SHORTSTRING(" {1to8}");
|
||||
static const struct ZydisPredefinedTokenDECO_1TO8_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_1TO8 = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, '1', 't', 'o', '8', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_1TO8 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_1TO8;
|
||||
|
||||
static const ZydisShortString STR_DECO_1TO16 = ZYDIS_MAKE_SHORTSTRING(" {1to16}");
|
||||
static const struct ZydisPredefinedTokenDECO_1TO16_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[20];
|
||||
} TOK_DATA_DECO_1TO16 = { 20, 18, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 6, '1', 't', 'o', '1', '6', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_1TO16 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_1TO16;
|
||||
|
||||
static const ZydisShortString STR_DECO_1TO32 = ZYDIS_MAKE_SHORTSTRING(" {1to32}");
|
||||
static const struct ZydisPredefinedTokenDECO_1TO32_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[20];
|
||||
} TOK_DATA_DECO_1TO32 = { 20, 18, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 6, '1', 't', 'o', '3', '2', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_1TO32 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_1TO32;
|
||||
|
||||
static const ZydisShortString STR_DECO_1TO64 = ZYDIS_MAKE_SHORTSTRING(" {1to64}");
|
||||
static const struct ZydisPredefinedTokenDECO_1TO64_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[20];
|
||||
} TOK_DATA_DECO_1TO64 = { 20, 18, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 6, '1', 't', 'o', '6', '4', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_1TO64 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_1TO64;
|
||||
|
||||
static const ZydisShortString STR_DECO_4TO8 = ZYDIS_MAKE_SHORTSTRING(" {4to8}");
|
||||
static const struct ZydisPredefinedTokenDECO_4TO8_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_4TO8 = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, '4', 't', 'o', '8', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_4TO8 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_4TO8;
|
||||
|
||||
static const ZydisShortString STR_DECO_4TO16 = ZYDIS_MAKE_SHORTSTRING(" {4to16}");
|
||||
static const struct ZydisPredefinedTokenDECO_4TO16_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[20];
|
||||
} TOK_DATA_DECO_4TO16 = { 20, 18, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 6, '4', 't', 'o', '1', '6', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_4TO16 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_4TO16;
|
||||
|
||||
static const ZydisShortString STR_DECO_8TO16 = ZYDIS_MAKE_SHORTSTRING(" {8to16}");
|
||||
static const struct ZydisPredefinedTokenDECO_8TO16_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[20];
|
||||
} TOK_DATA_DECO_8TO16 = { 20, 18, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 6, '8', 't', 'o', '1', '6', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_8TO16 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_8TO16;
|
||||
|
||||
static const ZydisShortString STR_DECO_AAAA = ZYDIS_MAKE_SHORTSTRING(" {aaaa}");
|
||||
static const struct ZydisPredefinedTokenDECO_AAAA_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_AAAA = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'a', 'a', 'a', 'a', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_AAAA = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_AAAA;
|
||||
|
||||
static const ZydisShortString STR_DECO_BADC = ZYDIS_MAKE_SHORTSTRING(" {badc}");
|
||||
static const struct ZydisPredefinedTokenDECO_BADC_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_BADC = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'b', 'a', 'd', 'c', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_BADC = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_BADC;
|
||||
|
||||
static const ZydisShortString STR_DECO_BBBB = ZYDIS_MAKE_SHORTSTRING(" {bbbb}");
|
||||
static const struct ZydisPredefinedTokenDECO_BBBB_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_BBBB = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'b', 'b', 'b', 'b', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_BBBB = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_BBBB;
|
||||
|
||||
static const ZydisShortString STR_DECO_BEGIN = ZYDIS_MAKE_SHORTSTRING(" {");
|
||||
static const struct ZydisPredefinedTokenDECO_BEGIN_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[8];
|
||||
} TOK_DATA_DECO_BEGIN = { 8, 6, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 0, '{', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_BEGIN = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_BEGIN;
|
||||
|
||||
static const ZydisShortString STR_DECO_CCCC = ZYDIS_MAKE_SHORTSTRING(" {cccc}");
|
||||
static const struct ZydisPredefinedTokenDECO_CCCC_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_CCCC = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'c', 'c', 'c', 'c', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_CCCC = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_CCCC;
|
||||
|
||||
static const ZydisShortString STR_DECO_CDAB = ZYDIS_MAKE_SHORTSTRING(" {cdab}");
|
||||
static const struct ZydisPredefinedTokenDECO_CDAB_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_CDAB = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'c', 'd', 'a', 'b', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_CDAB = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_CDAB;
|
||||
|
||||
static const ZydisShortString STR_DECO_DACB = ZYDIS_MAKE_SHORTSTRING(" {dacb}");
|
||||
static const struct ZydisPredefinedTokenDECO_DACB_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_DACB = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'd', 'a', 'c', 'b', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DACB = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DACB;
|
||||
|
||||
static const ZydisShortString STR_DECO_DDDD = ZYDIS_MAKE_SHORTSTRING(" {dddd}");
|
||||
static const struct ZydisPredefinedTokenDECO_DDDD_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_DDDD = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'd', 'd', 'd', 'd', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DDDD = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DDDD;
|
||||
|
||||
static const ZydisShortString STR_DECO_EH = ZYDIS_MAKE_SHORTSTRING(" {eh}");
|
||||
static const struct ZydisPredefinedTokenDECO_EH_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[17];
|
||||
} TOK_DATA_DECO_EH = { 17, 15, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 3, 'e', 'h', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_EH = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_EH;
|
||||
|
||||
static const ZydisShortString STR_DECO_END = ZYDIS_MAKE_SHORTSTRING("}");
|
||||
static const struct ZydisPredefinedTokenDECO_END_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_DECO_END = { 4, 2, { ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_END = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_END;
|
||||
|
||||
static const ZydisShortString STR_DECO_FLOAT16 = ZYDIS_MAKE_SHORTSTRING(" {float16}");
|
||||
static const struct ZydisPredefinedTokenDECO_FLOAT16_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[22];
|
||||
} TOK_DATA_DECO_FLOAT16 = { 22, 20, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 8, 'f', 'l', 'o', 'a', 't', '1', '6', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_FLOAT16 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_FLOAT16;
|
||||
|
||||
static const ZydisShortString STR_DECO_RD = ZYDIS_MAKE_SHORTSTRING(" {rd}");
|
||||
static const struct ZydisPredefinedTokenDECO_RD_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[17];
|
||||
} TOK_DATA_DECO_RD = { 17, 15, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 3, 'r', 'd', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_RD = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_RD;
|
||||
|
||||
static const ZydisShortString STR_DECO_RD_SAE = ZYDIS_MAKE_SHORTSTRING(" {rd-sae}");
|
||||
static const struct ZydisPredefinedTokenDECO_RD_SAE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_RD_SAE = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'r', 'd', '-', 's', 'a', 'e', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_RD_SAE = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_RD_SAE;
|
||||
|
||||
static const ZydisShortString STR_DECO_RN = ZYDIS_MAKE_SHORTSTRING(" {rn}");
|
||||
static const struct ZydisPredefinedTokenDECO_RN_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[17];
|
||||
} TOK_DATA_DECO_RN = { 17, 15, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 3, 'r', 'n', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_RN = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_RN;
|
||||
|
||||
static const ZydisShortString STR_DECO_RN_SAE = ZYDIS_MAKE_SHORTSTRING(" {rn-sae}");
|
||||
static const struct ZydisPredefinedTokenDECO_RN_SAE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_RN_SAE = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'r', 'n', '-', 's', 'a', 'e', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_RN_SAE = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_RN_SAE;
|
||||
|
||||
static const ZydisShortString STR_DECO_RU = ZYDIS_MAKE_SHORTSTRING(" {ru}");
|
||||
static const struct ZydisPredefinedTokenDECO_RU_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[17];
|
||||
} TOK_DATA_DECO_RU = { 17, 15, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 3, 'r', 'u', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_RU = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_RU;
|
||||
|
||||
static const ZydisShortString STR_DECO_RU_SAE = ZYDIS_MAKE_SHORTSTRING(" {ru-sae}");
|
||||
static const struct ZydisPredefinedTokenDECO_RU_SAE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_RU_SAE = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'r', 'u', '-', 's', 'a', 'e', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_RU_SAE = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_RU_SAE;
|
||||
|
||||
static const ZydisShortString STR_DECO_RZ = ZYDIS_MAKE_SHORTSTRING(" {rz}");
|
||||
static const struct ZydisPredefinedTokenDECO_RZ_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[17];
|
||||
} TOK_DATA_DECO_RZ = { 17, 15, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 3, 'r', 'z', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_RZ = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_RZ;
|
||||
|
||||
static const ZydisShortString STR_DECO_RZ_SAE = ZYDIS_MAKE_SHORTSTRING(" {rz-sae}");
|
||||
static const struct ZydisPredefinedTokenDECO_RZ_SAE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_RZ_SAE = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'r', 'z', '-', 's', 'a', 'e', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_RZ_SAE = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_RZ_SAE;
|
||||
|
||||
static const ZydisShortString STR_DECO_SAE = ZYDIS_MAKE_SHORTSTRING(" {sae}");
|
||||
static const struct ZydisPredefinedTokenDECO_SAE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[18];
|
||||
} TOK_DATA_DECO_SAE = { 18, 16, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 4, 's', 'a', 'e', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_SAE = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_SAE;
|
||||
|
||||
static const ZydisShortString STR_DECO_SINT8 = ZYDIS_MAKE_SHORTSTRING(" {sint8}");
|
||||
static const struct ZydisPredefinedTokenDECO_SINT8_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[20];
|
||||
} TOK_DATA_DECO_SINT8 = { 20, 18, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 6, 's', 'i', 'n', 't', '8', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_SINT8 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_SINT8;
|
||||
|
||||
static const ZydisShortString STR_DECO_SINT16 = ZYDIS_MAKE_SHORTSTRING(" {sint16}");
|
||||
static const struct ZydisPredefinedTokenDECO_SINT16_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_SINT16 = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 's', 'i', 'n', 't', '1', '6', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_SINT16 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_SINT16;
|
||||
|
||||
static const ZydisShortString STR_DECO_UINT8 = ZYDIS_MAKE_SHORTSTRING(" {uint8}");
|
||||
static const struct ZydisPredefinedTokenDECO_UINT8_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[20];
|
||||
} TOK_DATA_DECO_UINT8 = { 20, 18, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 6, 'u', 'i', 'n', 't', '8', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_UINT8 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_UINT8;
|
||||
|
||||
static const ZydisShortString STR_DECO_UINT16 = ZYDIS_MAKE_SHORTSTRING(" {uint16}");
|
||||
static const struct ZydisPredefinedTokenDECO_UINT16_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_UINT16 = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'u', 'i', 'n', 't', '1', '6', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_UINT16 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_UINT16;
|
||||
|
||||
static const ZydisShortString STR_DECO_ZERO = ZYDIS_MAKE_SHORTSTRING(" {z}");
|
||||
static const struct ZydisPredefinedTokenDECO_ZERO_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[16];
|
||||
} TOK_DATA_DECO_ZERO = { 16, 14, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 2, 'z', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_ZERO = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_ZERO;
|
||||
|
||||
static const ZydisShortString STR_DELIM_MEMORY = ZYDIS_MAKE_SHORTSTRING(",");
|
||||
static const struct ZydisPredefinedTokenDELIM_MEMORY_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_DELIM_MEMORY = { 4, 2, { ZYDIS_TOKEN_DELIMITER, 0, ',', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DELIM_MEMORY = (const ZydisPredefinedToken* const)&TOK_DATA_DELIM_MEMORY;
|
||||
|
||||
static const ZydisShortString STR_DELIM_MNEMONIC = ZYDIS_MAKE_SHORTSTRING(" ");
|
||||
static const struct ZydisPredefinedTokenDELIM_MNEMONIC_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_DELIM_MNEMONIC = { 4, 2, { ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DELIM_MNEMONIC = (const ZydisPredefinedToken* const)&TOK_DATA_DELIM_MNEMONIC;
|
||||
|
||||
static const ZydisShortString STR_DELIM_OPERAND = ZYDIS_MAKE_SHORTSTRING(", ");
|
||||
static const struct ZydisPredefinedTokenDELIM_OPERAND_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[8];
|
||||
} TOK_DATA_DELIM_OPERAND = { 8, 6, { ZYDIS_TOKEN_DELIMITER, 2, ',', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DELIM_OPERAND = (const ZydisPredefinedToken* const)&TOK_DATA_DELIM_OPERAND;
|
||||
|
||||
static const ZydisShortString STR_DELIM_SEGMENT = ZYDIS_MAKE_SHORTSTRING(":");
|
||||
static const struct ZydisPredefinedTokenDELIM_SEGMENT_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_DELIM_SEGMENT = { 4, 2, { ZYDIS_TOKEN_DELIMITER, 0, ':', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DELIM_SEGMENT = (const ZydisPredefinedToken* const)&TOK_DATA_DELIM_SEGMENT;
|
||||
|
||||
static const ZydisShortString STR_FAR = ZYDIS_MAKE_SHORTSTRING(" far");
|
||||
static const ZydisShortString STR_FAR_ATT = ZYDIS_MAKE_SHORTSTRING("l");
|
||||
static const ZydisShortString STR_IMMEDIATE = ZYDIS_MAKE_SHORTSTRING("$");
|
||||
static const struct ZydisPredefinedTokenIMMEDIATE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_IMMEDIATE = { 4, 2, { ZYDIS_TOKEN_IMMEDIATE, 0, '$', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_IMMEDIATE = (const ZydisPredefinedToken* const)&TOK_DATA_IMMEDIATE;
|
||||
|
||||
static const ZydisShortString STR_INVALID_MNEMONIC = ZYDIS_MAKE_SHORTSTRING("invalid");
|
||||
static const struct ZydisPredefinedTokenINVALID_MNEMONIC_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[10];
|
||||
} TOK_DATA_INVALID_MNEMONIC = { 10, 2, { ZYDIS_TOKEN_MNEMONIC, 0, 'i', 'n', 'v', 'a', 'l', 'i', 'd', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_INVALID_MNEMONIC = (const ZydisPredefinedToken* const)&TOK_DATA_INVALID_MNEMONIC;
|
||||
|
||||
static const ZydisShortString STR_INVALID_REG = ZYDIS_MAKE_SHORTSTRING("invalid");
|
||||
static const struct ZydisPredefinedTokenINVALID_REG_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[10];
|
||||
} TOK_DATA_INVALID_REG = { 10, 2, { ZYDIS_TOKEN_REGISTER, 0, 'i', 'n', 'v', 'a', 'l', 'i', 'd', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_INVALID_REG = (const ZydisPredefinedToken* const)&TOK_DATA_INVALID_REG;
|
||||
|
||||
static const ZydisShortString STR_MEMORY_BEGIN_ATT = ZYDIS_MAKE_SHORTSTRING("(");
|
||||
static const struct ZydisPredefinedTokenMEMORY_BEGIN_ATT_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_MEMORY_BEGIN_ATT = { 4, 2, { ZYDIS_TOKEN_PARENTHESIS_OPEN, 0, '(', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_MEMORY_BEGIN_ATT = (const ZydisPredefinedToken* const)&TOK_DATA_MEMORY_BEGIN_ATT;
|
||||
|
||||
static const ZydisShortString STR_MEMORY_BEGIN_INTEL = ZYDIS_MAKE_SHORTSTRING("[");
|
||||
static const struct ZydisPredefinedTokenMEMORY_BEGIN_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_MEMORY_BEGIN_INTEL = { 4, 2, { ZYDIS_TOKEN_PARENTHESIS_OPEN, 0, '[', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_MEMORY_BEGIN_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_MEMORY_BEGIN_INTEL;
|
||||
|
||||
static const ZydisShortString STR_MEMORY_END_ATT = ZYDIS_MAKE_SHORTSTRING(")");
|
||||
static const struct ZydisPredefinedTokenMEMORY_END_ATT_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_MEMORY_END_ATT = { 4, 2, { ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, ')', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_MEMORY_END_ATT = (const ZydisPredefinedToken* const)&TOK_DATA_MEMORY_END_ATT;
|
||||
|
||||
static const ZydisShortString STR_MEMORY_END_INTEL = ZYDIS_MAKE_SHORTSTRING("]");
|
||||
static const struct ZydisPredefinedTokenMEMORY_END_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_MEMORY_END_INTEL = { 4, 2, { ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, ']', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_MEMORY_END_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_MEMORY_END_INTEL;
|
||||
|
||||
static const ZydisShortString STR_MUL = ZYDIS_MAKE_SHORTSTRING("*");
|
||||
static const struct ZydisPredefinedTokenMUL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_MUL = { 4, 2, { ZYDIS_TOKEN_DELIMITER, 0, '*', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_MUL = (const ZydisPredefinedToken* const)&TOK_DATA_MUL;
|
||||
|
||||
static const ZydisShortString STR_NEAR = ZYDIS_MAKE_SHORTSTRING(" near");
|
||||
static const ZydisShortString STR_PREF_BND = ZYDIS_MAKE_SHORTSTRING("bnd ");
|
||||
static const struct ZydisPredefinedTokenPREF_BND_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[10];
|
||||
} TOK_DATA_PREF_BND = { 10, 8, { ZYDIS_TOKEN_PREFIX, 4, 'b', 'n', 'd', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_BND = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_BND;
|
||||
|
||||
static const ZydisShortString STR_PREF_LOCK = ZYDIS_MAKE_SHORTSTRING("lock ");
|
||||
static const struct ZydisPredefinedTokenPREF_LOCK_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[11];
|
||||
} TOK_DATA_PREF_LOCK = { 11, 9, { ZYDIS_TOKEN_PREFIX, 5, 'l', 'o', 'c', 'k', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_LOCK = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_LOCK;
|
||||
|
||||
static const ZydisShortString STR_PREF_REP = ZYDIS_MAKE_SHORTSTRING("rep ");
|
||||
static const struct ZydisPredefinedTokenPREF_REP_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[10];
|
||||
} TOK_DATA_PREF_REP = { 10, 8, { ZYDIS_TOKEN_PREFIX, 4, 'r', 'e', 'p', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REP = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REP;
|
||||
|
||||
static const ZydisShortString STR_PREF_REPE = ZYDIS_MAKE_SHORTSTRING("repe ");
|
||||
static const struct ZydisPredefinedTokenPREF_REPE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[11];
|
||||
} TOK_DATA_PREF_REPE = { 11, 9, { ZYDIS_TOKEN_PREFIX, 5, 'r', 'e', 'p', 'e', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REPE = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REPE;
|
||||
|
||||
static const ZydisShortString STR_PREF_REPNE = ZYDIS_MAKE_SHORTSTRING("repne ");
|
||||
static const struct ZydisPredefinedTokenPREF_REPNE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[12];
|
||||
} TOK_DATA_PREF_REPNE = { 12, 10, { ZYDIS_TOKEN_PREFIX, 6, 'r', 'e', 'p', 'n', 'e', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REPNE = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REPNE;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_4A = ZYDIS_MAKE_SHORTSTRING("rex.wx ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_4A_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[13];
|
||||
} TOK_DATA_PREF_REX_4A = { 13, 11, { ZYDIS_TOKEN_PREFIX, 7, 'r', 'e', 'x', '.', 'w', 'x', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_4A = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4A;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_4B = ZYDIS_MAKE_SHORTSTRING("rex.wxb ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_4B_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[14];
|
||||
} TOK_DATA_PREF_REX_4B = { 14, 12, { ZYDIS_TOKEN_PREFIX, 8, 'r', 'e', 'x', '.', 'w', 'x', 'b', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_4B = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4B;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_4C = ZYDIS_MAKE_SHORTSTRING("rex.wr ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_4C_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[13];
|
||||
} TOK_DATA_PREF_REX_4C = { 13, 11, { ZYDIS_TOKEN_PREFIX, 7, 'r', 'e', 'x', '.', 'w', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_4C = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4C;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_4D = ZYDIS_MAKE_SHORTSTRING("rex.wrb ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_4D_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[14];
|
||||
} TOK_DATA_PREF_REX_4D = { 14, 12, { ZYDIS_TOKEN_PREFIX, 8, 'r', 'e', 'x', '.', 'w', 'r', 'b', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_4D = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4D;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_4E = ZYDIS_MAKE_SHORTSTRING("rex.wrx ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_4E_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[14];
|
||||
} TOK_DATA_PREF_REX_4E = { 14, 12, { ZYDIS_TOKEN_PREFIX, 8, 'r', 'e', 'x', '.', 'w', 'r', 'x', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_4E = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4E;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_4F = ZYDIS_MAKE_SHORTSTRING("rex.wrxb ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_4F_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[15];
|
||||
} TOK_DATA_PREF_REX_4F = { 15, 13, { ZYDIS_TOKEN_PREFIX, 9, 'r', 'e', 'x', '.', 'w', 'r', 'x', 'b', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_4F = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_4F;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_40 = ZYDIS_MAKE_SHORTSTRING("rex ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_40_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[10];
|
||||
} TOK_DATA_PREF_REX_40 = { 10, 8, { ZYDIS_TOKEN_PREFIX, 4, 'r', 'e', 'x', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_40 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_40;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_41 = ZYDIS_MAKE_SHORTSTRING("rex.b ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_41_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[12];
|
||||
} TOK_DATA_PREF_REX_41 = { 12, 10, { ZYDIS_TOKEN_PREFIX, 6, 'r', 'e', 'x', '.', 'b', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_41 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_41;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_42 = ZYDIS_MAKE_SHORTSTRING("rex.x ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_42_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[12];
|
||||
} TOK_DATA_PREF_REX_42 = { 12, 10, { ZYDIS_TOKEN_PREFIX, 6, 'r', 'e', 'x', '.', 'x', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_42 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_42;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_43 = ZYDIS_MAKE_SHORTSTRING("rex.xb ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_43_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[13];
|
||||
} TOK_DATA_PREF_REX_43 = { 13, 11, { ZYDIS_TOKEN_PREFIX, 7, 'r', 'e', 'x', '.', 'x', 'b', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_43 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_43;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_44 = ZYDIS_MAKE_SHORTSTRING("rex.r ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_44_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[12];
|
||||
} TOK_DATA_PREF_REX_44 = { 12, 10, { ZYDIS_TOKEN_PREFIX, 6, 'r', 'e', 'x', '.', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_44 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_44;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_45 = ZYDIS_MAKE_SHORTSTRING("rex.rb ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_45_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[13];
|
||||
} TOK_DATA_PREF_REX_45 = { 13, 11, { ZYDIS_TOKEN_PREFIX, 7, 'r', 'e', 'x', '.', 'r', 'b', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_45 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_45;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_46 = ZYDIS_MAKE_SHORTSTRING("rex.rx ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_46_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[13];
|
||||
} TOK_DATA_PREF_REX_46 = { 13, 11, { ZYDIS_TOKEN_PREFIX, 7, 'r', 'e', 'x', '.', 'r', 'x', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_46 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_46;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_47 = ZYDIS_MAKE_SHORTSTRING("rex.rxb ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_47_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[14];
|
||||
} TOK_DATA_PREF_REX_47 = { 14, 12, { ZYDIS_TOKEN_PREFIX, 8, 'r', 'e', 'x', '.', 'r', 'x', 'b', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_47 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_47;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_48 = ZYDIS_MAKE_SHORTSTRING("rex.w ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_48_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[12];
|
||||
} TOK_DATA_PREF_REX_48 = { 12, 10, { ZYDIS_TOKEN_PREFIX, 6, 'r', 'e', 'x', '.', 'w', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_48 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_48;
|
||||
|
||||
static const ZydisShortString STR_PREF_REX_49 = ZYDIS_MAKE_SHORTSTRING("rex.wb ");
|
||||
static const struct ZydisPredefinedTokenPREF_REX_49_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[13];
|
||||
} TOK_DATA_PREF_REX_49 = { 13, 11, { ZYDIS_TOKEN_PREFIX, 7, 'r', 'e', 'x', '.', 'w', 'b', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_REX_49 = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_REX_49;
|
||||
|
||||
static const ZydisShortString STR_PREF_SEG_CS = ZYDIS_MAKE_SHORTSTRING("cs ");
|
||||
static const struct ZydisPredefinedTokenPREF_SEG_CS_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[9];
|
||||
} TOK_DATA_PREF_SEG_CS = { 9, 7, { ZYDIS_TOKEN_PREFIX, 3, 'c', 's', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_SEG_CS = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_SEG_CS;
|
||||
|
||||
static const ZydisShortString STR_PREF_SEG_DS = ZYDIS_MAKE_SHORTSTRING("ds ");
|
||||
static const struct ZydisPredefinedTokenPREF_SEG_DS_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[9];
|
||||
} TOK_DATA_PREF_SEG_DS = { 9, 7, { ZYDIS_TOKEN_PREFIX, 3, 'd', 's', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_SEG_DS = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_SEG_DS;
|
||||
|
||||
static const ZydisShortString STR_PREF_SEG_ES = ZYDIS_MAKE_SHORTSTRING("es ");
|
||||
static const struct ZydisPredefinedTokenPREF_SEG_ES_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[9];
|
||||
} TOK_DATA_PREF_SEG_ES = { 9, 7, { ZYDIS_TOKEN_PREFIX, 3, 'e', 's', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_SEG_ES = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_SEG_ES;
|
||||
|
||||
static const ZydisShortString STR_PREF_SEG_FS = ZYDIS_MAKE_SHORTSTRING("fs ");
|
||||
static const struct ZydisPredefinedTokenPREF_SEG_FS_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[9];
|
||||
} TOK_DATA_PREF_SEG_FS = { 9, 7, { ZYDIS_TOKEN_PREFIX, 3, 'f', 's', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_SEG_FS = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_SEG_FS;
|
||||
|
||||
static const ZydisShortString STR_PREF_SEG_GS = ZYDIS_MAKE_SHORTSTRING("gs ");
|
||||
static const struct ZydisPredefinedTokenPREF_SEG_GS_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[9];
|
||||
} TOK_DATA_PREF_SEG_GS = { 9, 7, { ZYDIS_TOKEN_PREFIX, 3, 'g', 's', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_SEG_GS = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_SEG_GS;
|
||||
|
||||
static const ZydisShortString STR_PREF_SEG_SS = ZYDIS_MAKE_SHORTSTRING("ss ");
|
||||
static const struct ZydisPredefinedTokenPREF_SEG_SS_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[9];
|
||||
} TOK_DATA_PREF_SEG_SS = { 9, 7, { ZYDIS_TOKEN_PREFIX, 3, 's', 's', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_SEG_SS = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_SEG_SS;
|
||||
|
||||
static const ZydisShortString STR_PREF_XACQUIRE = ZYDIS_MAKE_SHORTSTRING("xacquire ");
|
||||
static const struct ZydisPredefinedTokenPREF_XACQUIRE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[15];
|
||||
} TOK_DATA_PREF_XACQUIRE = { 15, 13, { ZYDIS_TOKEN_PREFIX, 9, 'x', 'a', 'c', 'q', 'u', 'i', 'r', 'e', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_XACQUIRE = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_XACQUIRE;
|
||||
|
||||
static const ZydisShortString STR_PREF_XRELEASE = ZYDIS_MAKE_SHORTSTRING("xrelease ");
|
||||
static const struct ZydisPredefinedTokenPREF_XRELEASE_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[15];
|
||||
} TOK_DATA_PREF_XRELEASE = { 15, 13, { ZYDIS_TOKEN_PREFIX, 9, 'x', 'r', 'e', 'l', 'e', 'a', 's', 'e', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_XRELEASE = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_XRELEASE;
|
||||
|
||||
static const ZydisShortString STR_PREF_NOTRACK = ZYDIS_MAKE_SHORTSTRING("notrack ");
|
||||
static const struct ZydisPredefinedTokenPREF_NOTRACK_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[14];
|
||||
} TOK_DATA_PREF_NOTRACK = { 14, 12, { ZYDIS_TOKEN_PREFIX, 8, 'n', 'o', 't', 'r', 'a', 'c', 'k', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_PREF_NOTRACK = (const ZydisPredefinedToken* const)&TOK_DATA_PREF_NOTRACK;
|
||||
|
||||
static const ZydisShortString STR_REGISTER = ZYDIS_MAKE_SHORTSTRING("%");
|
||||
static const struct ZydisPredefinedTokenREGISTER_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_REGISTER = { 4, 2, { ZYDIS_TOKEN_REGISTER, 0, '%', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_REGISTER = (const ZydisPredefinedToken* const)&TOK_DATA_REGISTER;
|
||||
|
||||
static const ZydisShortString STR_SHORT = ZYDIS_MAKE_SHORTSTRING(" short");
|
||||
static const ZydisShortString STR_SIZE_8_ATT = ZYDIS_MAKE_SHORTSTRING("b");
|
||||
static const ZydisShortString STR_SIZE_8_INTEL = ZYDIS_MAKE_SHORTSTRING("byte ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_8_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[15];
|
||||
} TOK_DATA_SIZE_8_INTEL = { 15, 13, { ZYDIS_TOKEN_TYPECAST, 9, 'b', 'y', 't', 'e', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_8_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_8_INTEL;
|
||||
|
||||
static const ZydisShortString STR_SIZE_16_ATT = ZYDIS_MAKE_SHORTSTRING("w");
|
||||
static const ZydisShortString STR_SIZE_16_INTEL = ZYDIS_MAKE_SHORTSTRING("word ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_16_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[15];
|
||||
} TOK_DATA_SIZE_16_INTEL = { 15, 13, { ZYDIS_TOKEN_TYPECAST, 9, 'w', 'o', 'r', 'd', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_16_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_16_INTEL;
|
||||
|
||||
static const ZydisShortString STR_SIZE_32_ATT = ZYDIS_MAKE_SHORTSTRING("l");
|
||||
static const ZydisShortString STR_SIZE_32_INTEL = ZYDIS_MAKE_SHORTSTRING("dword ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_32_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[16];
|
||||
} TOK_DATA_SIZE_32_INTEL = { 16, 14, { ZYDIS_TOKEN_TYPECAST, 10, 'd', 'w', 'o', 'r', 'd', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_32_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_32_INTEL;
|
||||
|
||||
static const ZydisShortString STR_SIZE_48 = ZYDIS_MAKE_SHORTSTRING("fword ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_48_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[16];
|
||||
} TOK_DATA_SIZE_48 = { 16, 14, { ZYDIS_TOKEN_TYPECAST, 10, 'f', 'w', 'o', 'r', 'd', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_48 = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_48;
|
||||
|
||||
static const ZydisShortString STR_SIZE_64_ATT = ZYDIS_MAKE_SHORTSTRING("q");
|
||||
static const ZydisShortString STR_SIZE_64_INTEL = ZYDIS_MAKE_SHORTSTRING("qword ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_64_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[16];
|
||||
} TOK_DATA_SIZE_64_INTEL = { 16, 14, { ZYDIS_TOKEN_TYPECAST, 10, 'q', 'w', 'o', 'r', 'd', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_64_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_64_INTEL;
|
||||
|
||||
static const ZydisShortString STR_SIZE_80 = ZYDIS_MAKE_SHORTSTRING("tbyte ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_80_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[16];
|
||||
} TOK_DATA_SIZE_80 = { 16, 14, { ZYDIS_TOKEN_TYPECAST, 10, 't', 'b', 'y', 't', 'e', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_80 = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_80;
|
||||
|
||||
static const ZydisShortString STR_SIZE_128_ATT = ZYDIS_MAKE_SHORTSTRING("x");
|
||||
static const ZydisShortString STR_SIZE_128_INTEL = ZYDIS_MAKE_SHORTSTRING("xmmword ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_128_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[18];
|
||||
} TOK_DATA_SIZE_128_INTEL = { 18, 16, { ZYDIS_TOKEN_TYPECAST, 12, 'x', 'm', 'm', 'w', 'o', 'r', 'd', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_128_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_128_INTEL;
|
||||
|
||||
static const ZydisShortString STR_SIZE_256_ATT = ZYDIS_MAKE_SHORTSTRING("y");
|
||||
static const ZydisShortString STR_SIZE_256_INTEL = ZYDIS_MAKE_SHORTSTRING("ymmword ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_256_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[18];
|
||||
} TOK_DATA_SIZE_256_INTEL = { 18, 16, { ZYDIS_TOKEN_TYPECAST, 12, 'y', 'm', 'm', 'w', 'o', 'r', 'd', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_256_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_256_INTEL;
|
||||
|
||||
static const ZydisShortString STR_SIZE_512_ATT = ZYDIS_MAKE_SHORTSTRING("z");
|
||||
static const ZydisShortString STR_SIZE_512_INTEL = ZYDIS_MAKE_SHORTSTRING("zmmword ptr ");
|
||||
static const struct ZydisPredefinedTokenSIZE_512_INTEL_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[18];
|
||||
} TOK_DATA_SIZE_512_INTEL = { 18, 16, { ZYDIS_TOKEN_TYPECAST, 12, 'z', 'm', 'm', 'w', 'o', 'r', 'd', ' ', 'p', 't', 'r', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SIZE_512_INTEL = (const ZydisPredefinedToken* const)&TOK_DATA_SIZE_512_INTEL;
|
||||
|
||||
static const ZydisShortString STR_SUB = ZYDIS_MAKE_SHORTSTRING("-");
|
||||
static const struct ZydisPredefinedTokenSUB_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[4];
|
||||
} TOK_DATA_SUB = { 4, 2, { ZYDIS_TOKEN_DELIMITER, 0, '-', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_SUB = (const ZydisPredefinedToken* const)&TOK_DATA_SUB;
|
||||
|
||||
static const ZydisShortString STR_WHITESPACE = ZYDIS_MAKE_SHORTSTRING(" ");
|
||||
#pragma pack(pop)
|
58
dep/zydis/src/Generated/GetRelInfo.inc
Normal file
58
dep/zydis/src/Generated/GetRelInfo.inc
Normal file
@ -0,0 +1,58 @@
|
||||
const ZydisEncoderRelInfo *ZydisGetRelInfo(ZydisMnemonic mnemonic)
|
||||
{
|
||||
static const ZydisEncoderRelInfo info_lookup[9] =
|
||||
{
|
||||
{ { { 0, 3, 6 }, { 0, 4, 5 }, { 0, 0, 5 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
|
||||
{ { { 2, 4, 7 }, { 2, 5, 6 }, { 2, 0, 6 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_TRUE },
|
||||
{ { { 2, 0, 0 }, { 3, 0, 0 }, { 0, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
|
||||
{ { { 3, 0, 0 }, { 2, 0, 0 }, { 3, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
|
||||
{ { { 0, 0, 0 }, { 0, 0, 0 }, { 5, 0, 7 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
|
||||
{ { { 2, 3, 6 }, { 2, 4, 5 }, { 2, 0, 5 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
|
||||
{ { { 0, 0, 0 }, { 0, 0, 0 }, { 2, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
|
||||
{ { { 2, 0, 0 }, { 2, 0, 0 }, { 2, 0, 0 } }, ZYDIS_SIZE_HINT_ASZ, ZYAN_FALSE },
|
||||
{ { { 0, 4, 7 }, { 0, 5, 6 }, { 0, 5, 6 } }, ZYDIS_SIZE_HINT_OSZ, ZYAN_FALSE },
|
||||
};
|
||||
|
||||
switch (mnemonic)
|
||||
{
|
||||
case ZYDIS_MNEMONIC_CALL:
|
||||
return &info_lookup[0];
|
||||
case ZYDIS_MNEMONIC_JB:
|
||||
case ZYDIS_MNEMONIC_JBE:
|
||||
case ZYDIS_MNEMONIC_JL:
|
||||
case ZYDIS_MNEMONIC_JLE:
|
||||
case ZYDIS_MNEMONIC_JNB:
|
||||
case ZYDIS_MNEMONIC_JNBE:
|
||||
case ZYDIS_MNEMONIC_JNL:
|
||||
case ZYDIS_MNEMONIC_JNLE:
|
||||
case ZYDIS_MNEMONIC_JNO:
|
||||
case ZYDIS_MNEMONIC_JNP:
|
||||
case ZYDIS_MNEMONIC_JNS:
|
||||
case ZYDIS_MNEMONIC_JNZ:
|
||||
case ZYDIS_MNEMONIC_JO:
|
||||
case ZYDIS_MNEMONIC_JP:
|
||||
case ZYDIS_MNEMONIC_JS:
|
||||
case ZYDIS_MNEMONIC_JZ:
|
||||
return &info_lookup[1];
|
||||
case ZYDIS_MNEMONIC_JCXZ:
|
||||
return &info_lookup[2];
|
||||
case ZYDIS_MNEMONIC_JECXZ:
|
||||
return &info_lookup[3];
|
||||
case ZYDIS_MNEMONIC_JKNZD:
|
||||
case ZYDIS_MNEMONIC_JKZD:
|
||||
return &info_lookup[4];
|
||||
case ZYDIS_MNEMONIC_JMP:
|
||||
return &info_lookup[5];
|
||||
case ZYDIS_MNEMONIC_JRCXZ:
|
||||
return &info_lookup[6];
|
||||
case ZYDIS_MNEMONIC_LOOP:
|
||||
case ZYDIS_MNEMONIC_LOOPE:
|
||||
case ZYDIS_MNEMONIC_LOOPNE:
|
||||
return &info_lookup[7];
|
||||
case ZYDIS_MNEMONIC_XBEGIN:
|
||||
return &info_lookup[8];
|
||||
default:
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
}
|
||||
|
7839
dep/zydis/src/Generated/InstructionDefinitions.inc
Normal file
7839
dep/zydis/src/Generated/InstructionDefinitions.inc
Normal file
File diff suppressed because it is too large
Load Diff
23
dep/zydis/src/Generated/InstructionEncodings.inc
Normal file
23
dep/zydis/src/Generated/InstructionEncodings.inc
Normal file
@ -0,0 +1,23 @@
|
||||
static const ZydisInstructionEncodingInfo INSTR_ENCODINGS[] =
|
||||
{
|
||||
{ 0, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_DISP, { { 16, 32, 64 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 64 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 32, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 32, 32, 32 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE }, { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_FALSE, ZYAN_FALSE }, { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE }, { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE } } }
|
||||
};
|
7816
dep/zydis/src/Generated/OperandDefinitions.inc
Normal file
7816
dep/zydis/src/Generated/OperandDefinitions.inc
Normal file
File diff suppressed because it is too large
Load Diff
23
dep/zydis/src/Generated/RegisterClassLookup.inc
Normal file
23
dep/zydis/src/Generated/RegisterClassLookup.inc
Normal file
@ -0,0 +1,23 @@
|
||||
static const ZydisRegisterClassLookupItem REG_CLASS_LOOKUP[] =
|
||||
{
|
||||
/* INVALID */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
|
||||
/* GPR8 */ { ZYDIS_REGISTER_AL, ZYDIS_REGISTER_R15B, 8, 8 },
|
||||
/* GPR16 */ { ZYDIS_REGISTER_AX, ZYDIS_REGISTER_R15W, 16, 16 },
|
||||
/* GPR32 */ { ZYDIS_REGISTER_EAX, ZYDIS_REGISTER_R15D, 32, 32 },
|
||||
/* GPR64 */ { ZYDIS_REGISTER_RAX, ZYDIS_REGISTER_R15, 0, 64 },
|
||||
/* X87 */ { ZYDIS_REGISTER_ST0, ZYDIS_REGISTER_ST7, 80, 80 },
|
||||
/* MMX */ { ZYDIS_REGISTER_MM0, ZYDIS_REGISTER_MM7, 64, 64 },
|
||||
/* XMM */ { ZYDIS_REGISTER_XMM0, ZYDIS_REGISTER_XMM31, 128, 128 },
|
||||
/* YMM */ { ZYDIS_REGISTER_YMM0, ZYDIS_REGISTER_YMM31, 256, 256 },
|
||||
/* ZMM */ { ZYDIS_REGISTER_ZMM0, ZYDIS_REGISTER_ZMM31, 512, 512 },
|
||||
/* TMM */ { ZYDIS_REGISTER_TMM0, ZYDIS_REGISTER_TMM7, 8192, 8192 },
|
||||
/* FLAGS */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
|
||||
/* IP */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
|
||||
/* SEGMENT */ { ZYDIS_REGISTER_ES, ZYDIS_REGISTER_GS, 16, 16 },
|
||||
/* TABLE */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
|
||||
/* TEST */ { ZYDIS_REGISTER_TR0, ZYDIS_REGISTER_TR7, 32, 32 },
|
||||
/* CONTROL */ { ZYDIS_REGISTER_CR0, ZYDIS_REGISTER_CR15, 32, 64 },
|
||||
/* DEBUG */ { ZYDIS_REGISTER_DR0, ZYDIS_REGISTER_DR15, 32, 64 },
|
||||
/* MASK */ { ZYDIS_REGISTER_K0, ZYDIS_REGISTER_K7, 64, 64 },
|
||||
/* BOUND */ { ZYDIS_REGISTER_BND0, ZYDIS_REGISTER_BND3, 128, 128 }
|
||||
};
|
269
dep/zydis/src/Generated/RegisterLookup.inc
Normal file
269
dep/zydis/src/Generated/RegisterLookup.inc
Normal file
@ -0,0 +1,269 @@
|
||||
static const ZydisRegisterLookupItem REG_LOOKUP[] =
|
||||
{
|
||||
/* NONE */ { ZYDIS_REGCLASS_INVALID, -1, 0, 0 },
|
||||
/* AL */ { ZYDIS_REGCLASS_GPR8, 0, 8, 8 },
|
||||
/* CL */ { ZYDIS_REGCLASS_GPR8, 1, 8, 8 },
|
||||
/* DL */ { ZYDIS_REGCLASS_GPR8, 2, 8, 8 },
|
||||
/* BL */ { ZYDIS_REGCLASS_GPR8, 3, 8, 8 },
|
||||
/* AH */ { ZYDIS_REGCLASS_GPR8, 4, 8, 8 },
|
||||
/* CH */ { ZYDIS_REGCLASS_GPR8, 5, 8, 8 },
|
||||
/* DH */ { ZYDIS_REGCLASS_GPR8, 6, 8, 8 },
|
||||
/* BH */ { ZYDIS_REGCLASS_GPR8, 7, 8, 8 },
|
||||
/* SPL */ { ZYDIS_REGCLASS_GPR8, 8, 8, 8 },
|
||||
/* BPL */ { ZYDIS_REGCLASS_GPR8, 9, 8, 8 },
|
||||
/* SIL */ { ZYDIS_REGCLASS_GPR8, 10, 8, 8 },
|
||||
/* DIL */ { ZYDIS_REGCLASS_GPR8, 11, 8, 8 },
|
||||
/* R8B */ { ZYDIS_REGCLASS_GPR8, 12, 8, 8 },
|
||||
/* R9B */ { ZYDIS_REGCLASS_GPR8, 13, 8, 8 },
|
||||
/* R10B */ { ZYDIS_REGCLASS_GPR8, 14, 8, 8 },
|
||||
/* R11B */ { ZYDIS_REGCLASS_GPR8, 15, 8, 8 },
|
||||
/* R12B */ { ZYDIS_REGCLASS_GPR8, 16, 8, 8 },
|
||||
/* R13B */ { ZYDIS_REGCLASS_GPR8, 17, 8, 8 },
|
||||
/* R14B */ { ZYDIS_REGCLASS_GPR8, 18, 8, 8 },
|
||||
/* R15B */ { ZYDIS_REGCLASS_GPR8, 19, 8, 8 },
|
||||
/* AX */ { ZYDIS_REGCLASS_GPR16, 0, 16, 16 },
|
||||
/* CX */ { ZYDIS_REGCLASS_GPR16, 1, 16, 16 },
|
||||
/* DX */ { ZYDIS_REGCLASS_GPR16, 2, 16, 16 },
|
||||
/* BX */ { ZYDIS_REGCLASS_GPR16, 3, 16, 16 },
|
||||
/* SP */ { ZYDIS_REGCLASS_GPR16, 4, 16, 16 },
|
||||
/* BP */ { ZYDIS_REGCLASS_GPR16, 5, 16, 16 },
|
||||
/* SI */ { ZYDIS_REGCLASS_GPR16, 6, 16, 16 },
|
||||
/* DI */ { ZYDIS_REGCLASS_GPR16, 7, 16, 16 },
|
||||
/* R8W */ { ZYDIS_REGCLASS_GPR16, 8, 16, 16 },
|
||||
/* R9W */ { ZYDIS_REGCLASS_GPR16, 9, 16, 16 },
|
||||
/* R10W */ { ZYDIS_REGCLASS_GPR16, 10, 16, 16 },
|
||||
/* R11W */ { ZYDIS_REGCLASS_GPR16, 11, 16, 16 },
|
||||
/* R12W */ { ZYDIS_REGCLASS_GPR16, 12, 16, 16 },
|
||||
/* R13W */ { ZYDIS_REGCLASS_GPR16, 13, 16, 16 },
|
||||
/* R14W */ { ZYDIS_REGCLASS_GPR16, 14, 16, 16 },
|
||||
/* R15W */ { ZYDIS_REGCLASS_GPR16, 15, 16, 16 },
|
||||
/* EAX */ { ZYDIS_REGCLASS_GPR32, 0, 32, 32 },
|
||||
/* ECX */ { ZYDIS_REGCLASS_GPR32, 1, 32, 32 },
|
||||
/* EDX */ { ZYDIS_REGCLASS_GPR32, 2, 32, 32 },
|
||||
/* EBX */ { ZYDIS_REGCLASS_GPR32, 3, 32, 32 },
|
||||
/* ESP */ { ZYDIS_REGCLASS_GPR32, 4, 32, 32 },
|
||||
/* EBP */ { ZYDIS_REGCLASS_GPR32, 5, 32, 32 },
|
||||
/* ESI */ { ZYDIS_REGCLASS_GPR32, 6, 32, 32 },
|
||||
/* EDI */ { ZYDIS_REGCLASS_GPR32, 7, 32, 32 },
|
||||
/* R8D */ { ZYDIS_REGCLASS_GPR32, 8, 32, 32 },
|
||||
/* R9D */ { ZYDIS_REGCLASS_GPR32, 9, 32, 32 },
|
||||
/* R10D */ { ZYDIS_REGCLASS_GPR32, 10, 32, 32 },
|
||||
/* R11D */ { ZYDIS_REGCLASS_GPR32, 11, 32, 32 },
|
||||
/* R12D */ { ZYDIS_REGCLASS_GPR32, 12, 32, 32 },
|
||||
/* R13D */ { ZYDIS_REGCLASS_GPR32, 13, 32, 32 },
|
||||
/* R14D */ { ZYDIS_REGCLASS_GPR32, 14, 32, 32 },
|
||||
/* R15D */ { ZYDIS_REGCLASS_GPR32, 15, 32, 32 },
|
||||
/* RAX */ { ZYDIS_REGCLASS_GPR64, 0, 0, 64 },
|
||||
/* RCX */ { ZYDIS_REGCLASS_GPR64, 1, 0, 64 },
|
||||
/* RDX */ { ZYDIS_REGCLASS_GPR64, 2, 0, 64 },
|
||||
/* RBX */ { ZYDIS_REGCLASS_GPR64, 3, 0, 64 },
|
||||
/* RSP */ { ZYDIS_REGCLASS_GPR64, 4, 0, 64 },
|
||||
/* RBP */ { ZYDIS_REGCLASS_GPR64, 5, 0, 64 },
|
||||
/* RSI */ { ZYDIS_REGCLASS_GPR64, 6, 0, 64 },
|
||||
/* RDI */ { ZYDIS_REGCLASS_GPR64, 7, 0, 64 },
|
||||
/* R8 */ { ZYDIS_REGCLASS_GPR64, 8, 0, 64 },
|
||||
/* R9 */ { ZYDIS_REGCLASS_GPR64, 9, 0, 64 },
|
||||
/* R10 */ { ZYDIS_REGCLASS_GPR64, 10, 0, 64 },
|
||||
/* R11 */ { ZYDIS_REGCLASS_GPR64, 11, 0, 64 },
|
||||
/* R12 */ { ZYDIS_REGCLASS_GPR64, 12, 0, 64 },
|
||||
/* R13 */ { ZYDIS_REGCLASS_GPR64, 13, 0, 64 },
|
||||
/* R14 */ { ZYDIS_REGCLASS_GPR64, 14, 0, 64 },
|
||||
/* R15 */ { ZYDIS_REGCLASS_GPR64, 15, 0, 64 },
|
||||
/* ST0 */ { ZYDIS_REGCLASS_X87, 0, 80, 80 },
|
||||
/* ST1 */ { ZYDIS_REGCLASS_X87, 1, 80, 80 },
|
||||
/* ST2 */ { ZYDIS_REGCLASS_X87, 2, 80, 80 },
|
||||
/* ST3 */ { ZYDIS_REGCLASS_X87, 3, 80, 80 },
|
||||
/* ST4 */ { ZYDIS_REGCLASS_X87, 4, 80, 80 },
|
||||
/* ST5 */ { ZYDIS_REGCLASS_X87, 5, 80, 80 },
|
||||
/* ST6 */ { ZYDIS_REGCLASS_X87, 6, 80, 80 },
|
||||
/* ST7 */ { ZYDIS_REGCLASS_X87, 7, 80, 80 },
|
||||
/* X87CONTROL */ { ZYDIS_REGCLASS_INVALID, -1, 16, 16 },
|
||||
/* X87STATUS */ { ZYDIS_REGCLASS_INVALID, -1, 16, 16 },
|
||||
/* X87TAG */ { ZYDIS_REGCLASS_INVALID, -1, 16, 16 },
|
||||
/* MM0 */ { ZYDIS_REGCLASS_MMX, 0, 64, 64 },
|
||||
/* MM1 */ { ZYDIS_REGCLASS_MMX, 1, 64, 64 },
|
||||
/* MM2 */ { ZYDIS_REGCLASS_MMX, 2, 64, 64 },
|
||||
/* MM3 */ { ZYDIS_REGCLASS_MMX, 3, 64, 64 },
|
||||
/* MM4 */ { ZYDIS_REGCLASS_MMX, 4, 64, 64 },
|
||||
/* MM5 */ { ZYDIS_REGCLASS_MMX, 5, 64, 64 },
|
||||
/* MM6 */ { ZYDIS_REGCLASS_MMX, 6, 64, 64 },
|
||||
/* MM7 */ { ZYDIS_REGCLASS_MMX, 7, 64, 64 },
|
||||
/* XMM0 */ { ZYDIS_REGCLASS_XMM, 0, 128, 128 },
|
||||
/* XMM1 */ { ZYDIS_REGCLASS_XMM, 1, 128, 128 },
|
||||
/* XMM2 */ { ZYDIS_REGCLASS_XMM, 2, 128, 128 },
|
||||
/* XMM3 */ { ZYDIS_REGCLASS_XMM, 3, 128, 128 },
|
||||
/* XMM4 */ { ZYDIS_REGCLASS_XMM, 4, 128, 128 },
|
||||
/* XMM5 */ { ZYDIS_REGCLASS_XMM, 5, 128, 128 },
|
||||
/* XMM6 */ { ZYDIS_REGCLASS_XMM, 6, 128, 128 },
|
||||
/* XMM7 */ { ZYDIS_REGCLASS_XMM, 7, 128, 128 },
|
||||
/* XMM8 */ { ZYDIS_REGCLASS_XMM, 8, 128, 128 },
|
||||
/* XMM9 */ { ZYDIS_REGCLASS_XMM, 9, 128, 128 },
|
||||
/* XMM10 */ { ZYDIS_REGCLASS_XMM, 10, 128, 128 },
|
||||
/* XMM11 */ { ZYDIS_REGCLASS_XMM, 11, 128, 128 },
|
||||
/* XMM12 */ { ZYDIS_REGCLASS_XMM, 12, 128, 128 },
|
||||
/* XMM13 */ { ZYDIS_REGCLASS_XMM, 13, 128, 128 },
|
||||
/* XMM14 */ { ZYDIS_REGCLASS_XMM, 14, 128, 128 },
|
||||
/* XMM15 */ { ZYDIS_REGCLASS_XMM, 15, 128, 128 },
|
||||
/* XMM16 */ { ZYDIS_REGCLASS_XMM, 16, 128, 128 },
|
||||
/* XMM17 */ { ZYDIS_REGCLASS_XMM, 17, 128, 128 },
|
||||
/* XMM18 */ { ZYDIS_REGCLASS_XMM, 18, 128, 128 },
|
||||
/* XMM19 */ { ZYDIS_REGCLASS_XMM, 19, 128, 128 },
|
||||
/* XMM20 */ { ZYDIS_REGCLASS_XMM, 20, 128, 128 },
|
||||
/* XMM21 */ { ZYDIS_REGCLASS_XMM, 21, 128, 128 },
|
||||
/* XMM22 */ { ZYDIS_REGCLASS_XMM, 22, 128, 128 },
|
||||
/* XMM23 */ { ZYDIS_REGCLASS_XMM, 23, 128, 128 },
|
||||
/* XMM24 */ { ZYDIS_REGCLASS_XMM, 24, 128, 128 },
|
||||
/* XMM25 */ { ZYDIS_REGCLASS_XMM, 25, 128, 128 },
|
||||
/* XMM26 */ { ZYDIS_REGCLASS_XMM, 26, 128, 128 },
|
||||
/* XMM27 */ { ZYDIS_REGCLASS_XMM, 27, 128, 128 },
|
||||
/* XMM28 */ { ZYDIS_REGCLASS_XMM, 28, 128, 128 },
|
||||
/* XMM29 */ { ZYDIS_REGCLASS_XMM, 29, 128, 128 },
|
||||
/* XMM30 */ { ZYDIS_REGCLASS_XMM, 30, 128, 128 },
|
||||
/* XMM31 */ { ZYDIS_REGCLASS_XMM, 31, 128, 128 },
|
||||
/* YMM0 */ { ZYDIS_REGCLASS_YMM, 0, 256, 256 },
|
||||
/* YMM1 */ { ZYDIS_REGCLASS_YMM, 1, 256, 256 },
|
||||
/* YMM2 */ { ZYDIS_REGCLASS_YMM, 2, 256, 256 },
|
||||
/* YMM3 */ { ZYDIS_REGCLASS_YMM, 3, 256, 256 },
|
||||
/* YMM4 */ { ZYDIS_REGCLASS_YMM, 4, 256, 256 },
|
||||
/* YMM5 */ { ZYDIS_REGCLASS_YMM, 5, 256, 256 },
|
||||
/* YMM6 */ { ZYDIS_REGCLASS_YMM, 6, 256, 256 },
|
||||
/* YMM7 */ { ZYDIS_REGCLASS_YMM, 7, 256, 256 },
|
||||
/* YMM8 */ { ZYDIS_REGCLASS_YMM, 8, 256, 256 },
|
||||
/* YMM9 */ { ZYDIS_REGCLASS_YMM, 9, 256, 256 },
|
||||
/* YMM10 */ { ZYDIS_REGCLASS_YMM, 10, 256, 256 },
|
||||
/* YMM11 */ { ZYDIS_REGCLASS_YMM, 11, 256, 256 },
|
||||
/* YMM12 */ { ZYDIS_REGCLASS_YMM, 12, 256, 256 },
|
||||
/* YMM13 */ { ZYDIS_REGCLASS_YMM, 13, 256, 256 },
|
||||
/* YMM14 */ { ZYDIS_REGCLASS_YMM, 14, 256, 256 },
|
||||
/* YMM15 */ { ZYDIS_REGCLASS_YMM, 15, 256, 256 },
|
||||
/* YMM16 */ { ZYDIS_REGCLASS_YMM, 16, 256, 256 },
|
||||
/* YMM17 */ { ZYDIS_REGCLASS_YMM, 17, 256, 256 },
|
||||
/* YMM18 */ { ZYDIS_REGCLASS_YMM, 18, 256, 256 },
|
||||
/* YMM19 */ { ZYDIS_REGCLASS_YMM, 19, 256, 256 },
|
||||
/* YMM20 */ { ZYDIS_REGCLASS_YMM, 20, 256, 256 },
|
||||
/* YMM21 */ { ZYDIS_REGCLASS_YMM, 21, 256, 256 },
|
||||
/* YMM22 */ { ZYDIS_REGCLASS_YMM, 22, 256, 256 },
|
||||
/* YMM23 */ { ZYDIS_REGCLASS_YMM, 23, 256, 256 },
|
||||
/* YMM24 */ { ZYDIS_REGCLASS_YMM, 24, 256, 256 },
|
||||
/* YMM25 */ { ZYDIS_REGCLASS_YMM, 25, 256, 256 },
|
||||
/* YMM26 */ { ZYDIS_REGCLASS_YMM, 26, 256, 256 },
|
||||
/* YMM27 */ { ZYDIS_REGCLASS_YMM, 27, 256, 256 },
|
||||
/* YMM28 */ { ZYDIS_REGCLASS_YMM, 28, 256, 256 },
|
||||
/* YMM29 */ { ZYDIS_REGCLASS_YMM, 29, 256, 256 },
|
||||
/* YMM30 */ { ZYDIS_REGCLASS_YMM, 30, 256, 256 },
|
||||
/* YMM31 */ { ZYDIS_REGCLASS_YMM, 31, 256, 256 },
|
||||
/* ZMM0 */ { ZYDIS_REGCLASS_ZMM, 0, 512, 512 },
|
||||
/* ZMM1 */ { ZYDIS_REGCLASS_ZMM, 1, 512, 512 },
|
||||
/* ZMM2 */ { ZYDIS_REGCLASS_ZMM, 2, 512, 512 },
|
||||
/* ZMM3 */ { ZYDIS_REGCLASS_ZMM, 3, 512, 512 },
|
||||
/* ZMM4 */ { ZYDIS_REGCLASS_ZMM, 4, 512, 512 },
|
||||
/* ZMM5 */ { ZYDIS_REGCLASS_ZMM, 5, 512, 512 },
|
||||
/* ZMM6 */ { ZYDIS_REGCLASS_ZMM, 6, 512, 512 },
|
||||
/* ZMM7 */ { ZYDIS_REGCLASS_ZMM, 7, 512, 512 },
|
||||
/* ZMM8 */ { ZYDIS_REGCLASS_ZMM, 8, 512, 512 },
|
||||
/* ZMM9 */ { ZYDIS_REGCLASS_ZMM, 9, 512, 512 },
|
||||
/* ZMM10 */ { ZYDIS_REGCLASS_ZMM, 10, 512, 512 },
|
||||
/* ZMM11 */ { ZYDIS_REGCLASS_ZMM, 11, 512, 512 },
|
||||
/* ZMM12 */ { ZYDIS_REGCLASS_ZMM, 12, 512, 512 },
|
||||
/* ZMM13 */ { ZYDIS_REGCLASS_ZMM, 13, 512, 512 },
|
||||
/* ZMM14 */ { ZYDIS_REGCLASS_ZMM, 14, 512, 512 },
|
||||
/* ZMM15 */ { ZYDIS_REGCLASS_ZMM, 15, 512, 512 },
|
||||
/* ZMM16 */ { ZYDIS_REGCLASS_ZMM, 16, 512, 512 },
|
||||
/* ZMM17 */ { ZYDIS_REGCLASS_ZMM, 17, 512, 512 },
|
||||
/* ZMM18 */ { ZYDIS_REGCLASS_ZMM, 18, 512, 512 },
|
||||
/* ZMM19 */ { ZYDIS_REGCLASS_ZMM, 19, 512, 512 },
|
||||
/* ZMM20 */ { ZYDIS_REGCLASS_ZMM, 20, 512, 512 },
|
||||
/* ZMM21 */ { ZYDIS_REGCLASS_ZMM, 21, 512, 512 },
|
||||
/* ZMM22 */ { ZYDIS_REGCLASS_ZMM, 22, 512, 512 },
|
||||
/* ZMM23 */ { ZYDIS_REGCLASS_ZMM, 23, 512, 512 },
|
||||
/* ZMM24 */ { ZYDIS_REGCLASS_ZMM, 24, 512, 512 },
|
||||
/* ZMM25 */ { ZYDIS_REGCLASS_ZMM, 25, 512, 512 },
|
||||
/* ZMM26 */ { ZYDIS_REGCLASS_ZMM, 26, 512, 512 },
|
||||
/* ZMM27 */ { ZYDIS_REGCLASS_ZMM, 27, 512, 512 },
|
||||
/* ZMM28 */ { ZYDIS_REGCLASS_ZMM, 28, 512, 512 },
|
||||
/* ZMM29 */ { ZYDIS_REGCLASS_ZMM, 29, 512, 512 },
|
||||
/* ZMM30 */ { ZYDIS_REGCLASS_ZMM, 30, 512, 512 },
|
||||
/* ZMM31 */ { ZYDIS_REGCLASS_ZMM, 31, 512, 512 },
|
||||
/* TMM0 */ { ZYDIS_REGCLASS_TMM, 0, 8192, 8192 },
|
||||
/* TMM1 */ { ZYDIS_REGCLASS_TMM, 1, 8192, 8192 },
|
||||
/* TMM2 */ { ZYDIS_REGCLASS_TMM, 2, 8192, 8192 },
|
||||
/* TMM3 */ { ZYDIS_REGCLASS_TMM, 3, 8192, 8192 },
|
||||
/* TMM4 */ { ZYDIS_REGCLASS_TMM, 4, 8192, 8192 },
|
||||
/* TMM5 */ { ZYDIS_REGCLASS_TMM, 5, 8192, 8192 },
|
||||
/* TMM6 */ { ZYDIS_REGCLASS_TMM, 6, 8192, 8192 },
|
||||
/* TMM7 */ { ZYDIS_REGCLASS_TMM, 7, 8192, 8192 },
|
||||
/* FLAGS */ { ZYDIS_REGCLASS_FLAGS, -1, 16, 16 },
|
||||
/* EFLAGS */ { ZYDIS_REGCLASS_FLAGS, -1, 32, 32 },
|
||||
/* RFLAGS */ { ZYDIS_REGCLASS_FLAGS, -1, 0, 64 },
|
||||
/* IP */ { ZYDIS_REGCLASS_IP, -1, 16, 16 },
|
||||
/* EIP */ { ZYDIS_REGCLASS_IP, -1, 32, 32 },
|
||||
/* RIP */ { ZYDIS_REGCLASS_IP, -1, 0, 64 },
|
||||
/* ES */ { ZYDIS_REGCLASS_SEGMENT, 0, 16, 16 },
|
||||
/* CS */ { ZYDIS_REGCLASS_SEGMENT, 1, 16, 16 },
|
||||
/* SS */ { ZYDIS_REGCLASS_SEGMENT, 2, 16, 16 },
|
||||
/* DS */ { ZYDIS_REGCLASS_SEGMENT, 3, 16, 16 },
|
||||
/* FS */ { ZYDIS_REGCLASS_SEGMENT, 4, 16, 16 },
|
||||
/* GS */ { ZYDIS_REGCLASS_SEGMENT, 5, 16, 16 },
|
||||
/* GDTR */ { ZYDIS_REGCLASS_TABLE, -1, 0, 0 },
|
||||
/* LDTR */ { ZYDIS_REGCLASS_TABLE, -1, 0, 0 },
|
||||
/* IDTR */ { ZYDIS_REGCLASS_TABLE, -1, 0, 0 },
|
||||
/* TR */ { ZYDIS_REGCLASS_TABLE, -1, 0, 0 },
|
||||
/* TR0 */ { ZYDIS_REGCLASS_TEST, 0, 32, 32 },
|
||||
/* TR1 */ { ZYDIS_REGCLASS_TEST, 1, 32, 32 },
|
||||
/* TR2 */ { ZYDIS_REGCLASS_TEST, 2, 32, 32 },
|
||||
/* TR3 */ { ZYDIS_REGCLASS_TEST, 3, 32, 32 },
|
||||
/* TR4 */ { ZYDIS_REGCLASS_TEST, 4, 32, 32 },
|
||||
/* TR5 */ { ZYDIS_REGCLASS_TEST, 5, 32, 32 },
|
||||
/* TR6 */ { ZYDIS_REGCLASS_TEST, 6, 32, 32 },
|
||||
/* TR7 */ { ZYDIS_REGCLASS_TEST, 7, 32, 32 },
|
||||
/* CR0 */ { ZYDIS_REGCLASS_CONTROL, 0, 32, 64 },
|
||||
/* CR1 */ { ZYDIS_REGCLASS_CONTROL, 1, 32, 64 },
|
||||
/* CR2 */ { ZYDIS_REGCLASS_CONTROL, 2, 32, 64 },
|
||||
/* CR3 */ { ZYDIS_REGCLASS_CONTROL, 3, 32, 64 },
|
||||
/* CR4 */ { ZYDIS_REGCLASS_CONTROL, 4, 32, 64 },
|
||||
/* CR5 */ { ZYDIS_REGCLASS_CONTROL, 5, 32, 64 },
|
||||
/* CR6 */ { ZYDIS_REGCLASS_CONTROL, 6, 32, 64 },
|
||||
/* CR7 */ { ZYDIS_REGCLASS_CONTROL, 7, 32, 64 },
|
||||
/* CR8 */ { ZYDIS_REGCLASS_CONTROL, 8, 32, 64 },
|
||||
/* CR9 */ { ZYDIS_REGCLASS_CONTROL, 9, 32, 64 },
|
||||
/* CR10 */ { ZYDIS_REGCLASS_CONTROL, 10, 32, 64 },
|
||||
/* CR11 */ { ZYDIS_REGCLASS_CONTROL, 11, 32, 64 },
|
||||
/* CR12 */ { ZYDIS_REGCLASS_CONTROL, 12, 32, 64 },
|
||||
/* CR13 */ { ZYDIS_REGCLASS_CONTROL, 13, 32, 64 },
|
||||
/* CR14 */ { ZYDIS_REGCLASS_CONTROL, 14, 32, 64 },
|
||||
/* CR15 */ { ZYDIS_REGCLASS_CONTROL, 15, 32, 64 },
|
||||
/* DR0 */ { ZYDIS_REGCLASS_DEBUG, 0, 32, 64 },
|
||||
/* DR1 */ { ZYDIS_REGCLASS_DEBUG, 1, 32, 64 },
|
||||
/* DR2 */ { ZYDIS_REGCLASS_DEBUG, 2, 32, 64 },
|
||||
/* DR3 */ { ZYDIS_REGCLASS_DEBUG, 3, 32, 64 },
|
||||
/* DR4 */ { ZYDIS_REGCLASS_DEBUG, 4, 32, 64 },
|
||||
/* DR5 */ { ZYDIS_REGCLASS_DEBUG, 5, 32, 64 },
|
||||
/* DR6 */ { ZYDIS_REGCLASS_DEBUG, 6, 32, 64 },
|
||||
/* DR7 */ { ZYDIS_REGCLASS_DEBUG, 7, 32, 64 },
|
||||
/* DR8 */ { ZYDIS_REGCLASS_DEBUG, 8, 32, 64 },
|
||||
/* DR9 */ { ZYDIS_REGCLASS_DEBUG, 9, 32, 64 },
|
||||
/* DR10 */ { ZYDIS_REGCLASS_DEBUG, 10, 32, 64 },
|
||||
/* DR11 */ { ZYDIS_REGCLASS_DEBUG, 11, 32, 64 },
|
||||
/* DR12 */ { ZYDIS_REGCLASS_DEBUG, 12, 32, 64 },
|
||||
/* DR13 */ { ZYDIS_REGCLASS_DEBUG, 13, 32, 64 },
|
||||
/* DR14 */ { ZYDIS_REGCLASS_DEBUG, 14, 32, 64 },
|
||||
/* DR15 */ { ZYDIS_REGCLASS_DEBUG, 15, 32, 64 },
|
||||
/* K0 */ { ZYDIS_REGCLASS_MASK, 0, 64, 64 },
|
||||
/* K1 */ { ZYDIS_REGCLASS_MASK, 1, 64, 64 },
|
||||
/* K2 */ { ZYDIS_REGCLASS_MASK, 2, 64, 64 },
|
||||
/* K3 */ { ZYDIS_REGCLASS_MASK, 3, 64, 64 },
|
||||
/* K4 */ { ZYDIS_REGCLASS_MASK, 4, 64, 64 },
|
||||
/* K5 */ { ZYDIS_REGCLASS_MASK, 5, 64, 64 },
|
||||
/* K6 */ { ZYDIS_REGCLASS_MASK, 6, 64, 64 },
|
||||
/* K7 */ { ZYDIS_REGCLASS_MASK, 7, 64, 64 },
|
||||
/* BND0 */ { ZYDIS_REGCLASS_BOUND, 0, 128, 128 },
|
||||
/* BND1 */ { ZYDIS_REGCLASS_BOUND, 1, 128, 128 },
|
||||
/* BND2 */ { ZYDIS_REGCLASS_BOUND, 2, 128, 128 },
|
||||
/* BND3 */ { ZYDIS_REGCLASS_BOUND, 3, 128, 128 },
|
||||
/* BNDCFG */ { ZYDIS_REGCLASS_INVALID, -1, 64, 64 },
|
||||
/* BNDSTATUS */ { ZYDIS_REGCLASS_INVALID, -1, 64, 64 },
|
||||
/* MXCSR */ { ZYDIS_REGCLASS_INVALID, -1, 32, 32 },
|
||||
/* PKRU */ { ZYDIS_REGCLASS_INVALID, -1, 32, 32 },
|
||||
/* XCR0 */ { ZYDIS_REGCLASS_INVALID, -1, 64, 64 },
|
||||
/* UIF */ { ZYDIS_REGCLASS_INVALID, -1, 1, 1 }
|
||||
};
|
69
dep/zydis/src/MetaInfo.c
Normal file
69
dep/zydis/src/MetaInfo.c
Normal file
@ -0,0 +1,69 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/MetaInfo.h>
|
||||
#include <Zycore/Types.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Enum strings */
|
||||
/* ============================================================================================== */
|
||||
|
||||
#include <Generated/EnumInstructionCategory.inc>
|
||||
#include <Generated/EnumISASet.inc>
|
||||
#include <Generated/EnumISAExt.inc>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
const char* ZydisCategoryGetString(ZydisInstructionCategory category)
|
||||
{
|
||||
if ((ZyanUSize)category >= ZYAN_ARRAY_LENGTH(STR_INSTRUCTIONCATEGORY))
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
return STR_INSTRUCTIONCATEGORY[category];
|
||||
}
|
||||
|
||||
const char* ZydisISASetGetString(ZydisISASet isa_set)
|
||||
{
|
||||
if ((ZyanUSize)isa_set >= ZYAN_ARRAY_LENGTH(STR_ISASET))
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
return STR_ISASET[isa_set];
|
||||
}
|
||||
|
||||
const char* ZydisISAExtGetString(ZydisISAExt isa_ext)
|
||||
{
|
||||
if ((ZyanUSize)isa_ext >= ZYAN_ARRAY_LENGTH(STR_ISAEXT))
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
return STR_ISAEXT[isa_ext];
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
52
dep/zydis/src/Mnemonic.c
Normal file
52
dep/zydis/src/Mnemonic.c
Normal file
@ -0,0 +1,52 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Mnemonic.h>
|
||||
#include <Generated/EnumMnemonic.inc>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
const char* ZydisMnemonicGetString(ZydisMnemonic mnemonic)
|
||||
{
|
||||
if ((ZyanUSize)mnemonic >= ZYAN_ARRAY_LENGTH(STR_MNEMONIC))
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
return (const char*)STR_MNEMONIC[mnemonic].data;
|
||||
}
|
||||
|
||||
const ZydisShortString* ZydisMnemonicGetStringWrapped(ZydisMnemonic mnemonic)
|
||||
{
|
||||
if ((ZyanUSize)mnemonic >= ZYAN_ARRAY_LENGTH(STR_MNEMONIC))
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
return &STR_MNEMONIC[mnemonic];
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
265
dep/zydis/src/Register.c
Normal file
265
dep/zydis/src/Register.c
Normal file
@ -0,0 +1,265 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Register.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Register strings */
|
||||
/* ============================================================================================== */
|
||||
|
||||
#include <Generated/EnumRegister.inc>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Register-class mapping */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/**
|
||||
* Defines the `ZydisRegisterMapItem` struct.
|
||||
*/
|
||||
typedef struct ZydisRegisterLookupItem
|
||||
{
|
||||
/**
|
||||
* The register class.
|
||||
*/
|
||||
ZydisRegisterClass class;
|
||||
/**
|
||||
* The register id.
|
||||
*/
|
||||
ZyanI8 id;
|
||||
/**
|
||||
* The width of register 16- and 32-bit mode.
|
||||
*/
|
||||
ZydisRegisterWidth width;
|
||||
/**
|
||||
* The width of register in 64-bit mode.
|
||||
*/
|
||||
ZydisRegisterWidth width64;
|
||||
} ZydisRegisterLookupItem;
|
||||
|
||||
#include <Generated/RegisterLookup.inc>
|
||||
|
||||
/**
|
||||
* Defines the `ZydisRegisterClassLookupItem` struct.
|
||||
*/
|
||||
typedef struct ZydisRegisterClassLookupItem_
|
||||
{
|
||||
/**
|
||||
* The lowest register of the current class.
|
||||
*/
|
||||
ZydisRegister lo;
|
||||
/**
|
||||
* The highest register of the current class.
|
||||
*/
|
||||
ZydisRegister hi;
|
||||
/**
|
||||
* The width of registers of the current class in 16- and 32-bit mode.
|
||||
*/
|
||||
ZydisRegisterWidth width;
|
||||
/**
|
||||
* The width of registers of the current class in 64-bit mode.
|
||||
*/
|
||||
ZydisRegisterWidth width64;
|
||||
} ZydisRegisterClassLookupItem;
|
||||
|
||||
#include <Generated/RegisterClassLookup.inc>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Register */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZydisRegister ZydisRegisterEncode(ZydisRegisterClass register_class, ZyanU8 id)
|
||||
{
|
||||
if ((register_class == ZYDIS_REGCLASS_INVALID) ||
|
||||
(register_class == ZYDIS_REGCLASS_FLAGS) ||
|
||||
(register_class == ZYDIS_REGCLASS_IP))
|
||||
{
|
||||
return ZYDIS_REGISTER_NONE;
|
||||
}
|
||||
|
||||
if ((ZyanUSize)register_class >= ZYAN_ARRAY_LENGTH(REG_CLASS_LOOKUP))
|
||||
{
|
||||
return ZYDIS_REGISTER_NONE;
|
||||
}
|
||||
|
||||
const ZydisRegisterClassLookupItem* item = ®_CLASS_LOOKUP[register_class];
|
||||
if (id <= (item->hi - item->lo))
|
||||
{
|
||||
return item->lo + id;
|
||||
}
|
||||
|
||||
return ZYDIS_REGISTER_NONE;
|
||||
}
|
||||
|
||||
ZyanI8 ZydisRegisterGetId(ZydisRegister reg)
|
||||
{
|
||||
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(REG_LOOKUP))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return REG_LOOKUP[reg].id;
|
||||
}
|
||||
|
||||
ZydisRegisterClass ZydisRegisterGetClass(ZydisRegister reg)
|
||||
{
|
||||
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(REG_LOOKUP))
|
||||
{
|
||||
return ZYDIS_REGCLASS_INVALID;
|
||||
}
|
||||
|
||||
return REG_LOOKUP[reg].class;
|
||||
}
|
||||
|
||||
ZydisRegisterWidth ZydisRegisterGetWidth(ZydisMachineMode mode, ZydisRegister reg)
|
||||
{
|
||||
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(REG_LOOKUP))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (mode == ZYDIS_MACHINE_MODE_LONG_64)
|
||||
? REG_LOOKUP[reg].width64
|
||||
: REG_LOOKUP[reg].width;
|
||||
}
|
||||
|
||||
ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, ZydisRegister reg)
|
||||
{
|
||||
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(REG_LOOKUP))
|
||||
{
|
||||
return ZYDIS_REGISTER_NONE;
|
||||
}
|
||||
|
||||
static const ZyanU8 GPR8_MAPPING[20] =
|
||||
{
|
||||
/* AL */ 0,
|
||||
/* CL */ 1,
|
||||
/* DL */ 2,
|
||||
/* BL */ 3,
|
||||
/* AH */ 0,
|
||||
/* CH */ 1,
|
||||
/* DH */ 2,
|
||||
/* BH */ 3,
|
||||
/* SPL */ 4,
|
||||
/* BPL */ 5,
|
||||
/* SIL */ 6,
|
||||
/* DIL */ 7,
|
||||
/* R8B */ 8,
|
||||
/* R9B */ 9,
|
||||
/* R10B */ 10,
|
||||
/* R11B */ 11,
|
||||
/* R12B */ 12,
|
||||
/* R13B */ 13,
|
||||
/* R14B */ 14,
|
||||
/* R15B */ 15,
|
||||
};
|
||||
|
||||
const ZydisRegisterClass reg_class = REG_LOOKUP[reg].class;
|
||||
if ((reg_class == ZYDIS_REGCLASS_INVALID) ||
|
||||
((reg_class == ZYDIS_REGCLASS_GPR64) && (mode != ZYDIS_MACHINE_MODE_LONG_64)))
|
||||
{
|
||||
return ZYDIS_REGISTER_NONE;
|
||||
}
|
||||
|
||||
ZyanU8 reg_id = REG_LOOKUP[reg].id;
|
||||
switch (reg_class)
|
||||
{
|
||||
case ZYDIS_REGCLASS_GPR8:
|
||||
reg_id = GPR8_MAPPING[reg_id];
|
||||
ZYAN_FALLTHROUGH;
|
||||
case ZYDIS_REGCLASS_GPR16:
|
||||
case ZYDIS_REGCLASS_GPR32:
|
||||
case ZYDIS_REGCLASS_GPR64:
|
||||
switch (mode)
|
||||
{
|
||||
case ZYDIS_MACHINE_MODE_LONG_64:
|
||||
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_GPR64].lo + reg_id;
|
||||
case ZYDIS_MACHINE_MODE_LONG_COMPAT_32:
|
||||
case ZYDIS_MACHINE_MODE_LEGACY_32:
|
||||
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_GPR32].lo + reg_id;
|
||||
case ZYDIS_MACHINE_MODE_LONG_COMPAT_16:
|
||||
case ZYDIS_MACHINE_MODE_LEGACY_16:
|
||||
case ZYDIS_MACHINE_MODE_REAL_16:
|
||||
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_GPR16].lo + reg_id;
|
||||
default:
|
||||
return ZYDIS_REGISTER_NONE;
|
||||
}
|
||||
case ZYDIS_REGCLASS_XMM:
|
||||
case ZYDIS_REGCLASS_YMM:
|
||||
case ZYDIS_REGCLASS_ZMM:
|
||||
#if defined(ZYDIS_DISABLE_AVX512) && defined(ZYDIS_DISABLE_KNC)
|
||||
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_YMM].lo + reg_id;
|
||||
#else
|
||||
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_ZMM].lo + reg_id;
|
||||
#endif
|
||||
default:
|
||||
return ZYDIS_REGISTER_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
const char* ZydisRegisterGetString(ZydisRegister reg)
|
||||
{
|
||||
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(STR_REGISTERS))
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
|
||||
return STR_REGISTERS[reg].data;
|
||||
}
|
||||
|
||||
const ZydisShortString* ZydisRegisterGetStringWrapped(ZydisRegister reg)
|
||||
{
|
||||
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(STR_REGISTERS))
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
|
||||
return &STR_REGISTERS[reg];
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Register class */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZydisRegisterWidth ZydisRegisterClassGetWidth(ZydisMachineMode mode,
|
||||
ZydisRegisterClass register_class)
|
||||
{
|
||||
if ((ZyanUSize)register_class >= ZYAN_ARRAY_LENGTH(REG_CLASS_LOOKUP))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (mode == ZYDIS_MACHINE_MODE_LONG_64)
|
||||
? REG_CLASS_LOOKUP[register_class].width64
|
||||
: REG_CLASS_LOOKUP[register_class].width;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
182
dep/zydis/src/Segment.c
Normal file
182
dep/zydis/src/Segment.c
Normal file
@ -0,0 +1,182 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zycore/LibC.h>
|
||||
#include <Zydis/Segment.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* instruction,
|
||||
ZydisInstructionSegments* segments)
|
||||
{
|
||||
if (!instruction || !segments)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZYAN_MEMSET(segments, 0, sizeof(*segments));
|
||||
|
||||
// Legacy prefixes and `REX`
|
||||
if (instruction->raw.prefix_count)
|
||||
{
|
||||
const ZyanU8 rex_offset = (instruction->attributes & ZYDIS_ATTRIB_HAS_REX) ? 1 : 0;
|
||||
if (!rex_offset || (instruction->raw.prefix_count > 1))
|
||||
{
|
||||
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_PREFIXES;
|
||||
segments->segments[segments->count ].offset = 0;
|
||||
segments->segments[segments->count++].size =
|
||||
instruction->raw.prefix_count - rex_offset;
|
||||
}
|
||||
if (rex_offset)
|
||||
{
|
||||
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_REX;
|
||||
segments->segments[segments->count ].offset =
|
||||
instruction->raw.prefix_count - rex_offset;
|
||||
segments->segments[segments->count++].size = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Encoding prefixes
|
||||
ZydisInstructionSegment segment_type = ZYDIS_INSTR_SEGMENT_NONE;
|
||||
ZyanU8 segment_offset = 0;
|
||||
ZyanU8 segment_size = 0;
|
||||
switch (instruction->encoding)
|
||||
{
|
||||
case ZYDIS_INSTRUCTION_ENCODING_XOP:
|
||||
segment_type = ZYDIS_INSTR_SEGMENT_XOP;
|
||||
segment_offset = instruction->raw.xop.offset;
|
||||
segment_size = 3;
|
||||
break;
|
||||
case ZYDIS_INSTRUCTION_ENCODING_VEX:
|
||||
segment_type = ZYDIS_INSTR_SEGMENT_VEX;
|
||||
segment_offset = instruction->raw.vex.offset;
|
||||
segment_size = instruction->raw.vex.size;
|
||||
break;
|
||||
case ZYDIS_INSTRUCTION_ENCODING_EVEX:
|
||||
segment_type = ZYDIS_INSTR_SEGMENT_EVEX;
|
||||
segment_offset = instruction->raw.evex.offset;
|
||||
segment_size = 4;
|
||||
break;
|
||||
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
|
||||
segment_type = ZYDIS_INSTR_SEGMENT_MVEX;
|
||||
segment_offset = instruction->raw.mvex.offset;
|
||||
segment_size = 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (segment_type)
|
||||
{
|
||||
segments->segments[segments->count ].type = segment_type;
|
||||
segments->segments[segments->count ].offset = segment_offset;
|
||||
segments->segments[segments->count++].size = segment_size;
|
||||
}
|
||||
|
||||
// Opcode
|
||||
segment_size = 1;
|
||||
if ((instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_LEGACY) ||
|
||||
(instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_3DNOW))
|
||||
{
|
||||
switch (instruction->opcode_map)
|
||||
{
|
||||
case ZYDIS_OPCODE_MAP_DEFAULT:
|
||||
break;
|
||||
case ZYDIS_OPCODE_MAP_0F:
|
||||
ZYAN_FALLTHROUGH;
|
||||
case ZYDIS_OPCODE_MAP_0F0F:
|
||||
segment_size = 2;
|
||||
break;
|
||||
case ZYDIS_OPCODE_MAP_0F38:
|
||||
ZYAN_FALLTHROUGH;
|
||||
case ZYDIS_OPCODE_MAP_0F3A:
|
||||
segment_size = 3;
|
||||
break;
|
||||
default:
|
||||
ZYAN_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_OPCODE;
|
||||
if (segments->count)
|
||||
{
|
||||
segments->segments[segments->count].offset =
|
||||
segments->segments[segments->count - 1].offset +
|
||||
segments->segments[segments->count - 1].size;
|
||||
} else
|
||||
{
|
||||
segments->segments[segments->count].offset = 0;
|
||||
}
|
||||
segments->segments[segments->count++].size = segment_size;
|
||||
|
||||
// ModRM
|
||||
if (instruction->attributes & ZYDIS_ATTRIB_HAS_MODRM)
|
||||
{
|
||||
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_MODRM;
|
||||
segments->segments[segments->count ].offset = instruction->raw.modrm.offset;
|
||||
segments->segments[segments->count++].size = 1;
|
||||
}
|
||||
|
||||
// SIB
|
||||
if (instruction->attributes & ZYDIS_ATTRIB_HAS_SIB)
|
||||
{
|
||||
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_SIB;
|
||||
segments->segments[segments->count ].offset = instruction->raw.sib.offset;
|
||||
segments->segments[segments->count++].size = 1;
|
||||
}
|
||||
|
||||
// Displacement
|
||||
if (instruction->raw.disp.size)
|
||||
{
|
||||
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_DISPLACEMENT;
|
||||
segments->segments[segments->count ].offset = instruction->raw.disp.offset;
|
||||
segments->segments[segments->count++].size = instruction->raw.disp.size / 8;
|
||||
}
|
||||
|
||||
// Immediates
|
||||
for (ZyanU8 i = 0; i < 2; ++i)
|
||||
{
|
||||
if (instruction->raw.imm[i].size)
|
||||
{
|
||||
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_IMMEDIATE;
|
||||
segments->segments[segments->count ].offset = instruction->raw.imm[i].offset;
|
||||
segments->segments[segments->count++].size = instruction->raw.imm[i].size / 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_3DNOW)
|
||||
{
|
||||
segments->segments[segments->count].type = ZYDIS_INSTR_SEGMENT_OPCODE;
|
||||
segments->segments[segments->count].offset = instruction->length -1;
|
||||
segments->segments[segments->count++].size = 1;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
186
dep/zydis/src/SharedData.c
Normal file
186
dep/zydis/src/SharedData.c
Normal file
@ -0,0 +1,186 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Internal/SharedData.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Data tables */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Instruction definitions */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef ZYDIS_MINIMAL_MODE
|
||||
# define ZYDIS_NOTMIN(x)
|
||||
#else
|
||||
# define ZYDIS_NOTMIN(x) , x
|
||||
#endif
|
||||
|
||||
#include <Generated/InstructionDefinitions.inc>
|
||||
|
||||
#undef ZYDIS_NOTMIN
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Operand definitions */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#define ZYDIS_OPERAND_DEFINITION(type, encoding, access) \
|
||||
{ type, encoding, access }
|
||||
|
||||
#include <Generated/OperandDefinitions.inc>
|
||||
|
||||
#undef ZYDIS_OPERAND_DEFINITION
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Accessed CPU flags */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#include <Generated/AccessedFlags.inc>
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Instruction definition */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding, ZyanU16 id,
|
||||
const ZydisInstructionDefinition** definition)
|
||||
{
|
||||
switch (encoding)
|
||||
{
|
||||
case ZYDIS_INSTRUCTION_ENCODING_LEGACY:
|
||||
*definition = (ZydisInstructionDefinition*)&ISTR_DEFINITIONS_LEGACY[id];
|
||||
break;
|
||||
case ZYDIS_INSTRUCTION_ENCODING_3DNOW:
|
||||
*definition = (ZydisInstructionDefinition*)&ISTR_DEFINITIONS_3DNOW[id];
|
||||
break;
|
||||
case ZYDIS_INSTRUCTION_ENCODING_XOP:
|
||||
*definition = (ZydisInstructionDefinition*)&ISTR_DEFINITIONS_XOP[id];
|
||||
break;
|
||||
case ZYDIS_INSTRUCTION_ENCODING_VEX:
|
||||
*definition = (ZydisInstructionDefinition*)&ISTR_DEFINITIONS_VEX[id];
|
||||
break;
|
||||
#ifndef ZYDIS_DISABLE_AVX512
|
||||
case ZYDIS_INSTRUCTION_ENCODING_EVEX:
|
||||
*definition = (ZydisInstructionDefinition*)&ISTR_DEFINITIONS_EVEX[id];
|
||||
break;
|
||||
#endif
|
||||
#ifndef ZYDIS_DISABLE_KNC
|
||||
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
|
||||
*definition = (ZydisInstructionDefinition*)&ISTR_DEFINITIONS_MVEX[id];
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ZYAN_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Operand definition */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef ZYDIS_MINIMAL_MODE
|
||||
const ZydisOperandDefinition* ZydisGetOperandDefinitions(
|
||||
const ZydisInstructionDefinition* definition)
|
||||
{
|
||||
if (definition->operand_count == 0)
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
ZYAN_ASSERT(definition->operand_reference != 0xFFFF);
|
||||
return &OPERAND_DEFINITIONS[definition->operand_reference];
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Element info */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef ZYDIS_MINIMAL_MODE
|
||||
void ZydisGetElementInfo(ZydisInternalElementType element, ZydisElementType* type,
|
||||
ZydisElementSize* size)
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
ZydisElementType type;
|
||||
ZydisElementSize size;
|
||||
} lookup[ZYDIS_IELEMENT_TYPE_MAX_VALUE + 1] =
|
||||
{
|
||||
{ ZYDIS_ELEMENT_TYPE_INVALID , 0 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INVALID , 0 },
|
||||
{ ZYDIS_ELEMENT_TYPE_STRUCT , 0 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 0 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 0 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 1 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 8 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 16 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 32 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 64 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 8 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 16 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 32 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 64 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 128 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 256 },
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT16 , 16 },
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT16 , 32 }, // TODO: Should indicate 2 float16 elements
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT32 , 32 },
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT64 , 64 },
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT80 , 80 },
|
||||
{ ZYDIS_ELEMENT_TYPE_LONGBCD , 80 },
|
||||
{ ZYDIS_ELEMENT_TYPE_CC , 3 },
|
||||
{ ZYDIS_ELEMENT_TYPE_CC , 5 }
|
||||
};
|
||||
|
||||
ZYAN_ASSERT((ZyanUSize)element < ZYAN_ARRAY_LENGTH(lookup));
|
||||
|
||||
*type = lookup[element].type;
|
||||
*size = lookup[element].size;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Accessed CPU flags */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef ZYDIS_MINIMAL_MODE
|
||||
ZyanBool ZydisGetAccessedFlags(const ZydisInstructionDefinition* definition,
|
||||
const ZydisDefinitionAccessedFlags** flags)
|
||||
{
|
||||
ZYAN_ASSERT(definition->flags_reference < ZYAN_ARRAY_LENGTH(ACCESSED_FLAGS));
|
||||
*flags = &ACCESSED_FLAGS[definition->flags_reference];
|
||||
return (definition->flags_reference != 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
376
dep/zydis/src/String.c
Normal file
376
dep/zydis/src/String.c
Normal file
@ -0,0 +1,376 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd, Joel Hoener
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Internal/String.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Constants */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Defines */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#define ZYDIS_MAXCHARS_DEC_32 10
|
||||
#define ZYDIS_MAXCHARS_DEC_64 20
|
||||
#define ZYDIS_MAXCHARS_HEX_32 8
|
||||
#define ZYDIS_MAXCHARS_HEX_64 16
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Lookup Tables */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
static const char* const DECIMAL_LOOKUP =
|
||||
"00010203040506070809"
|
||||
"10111213141516171819"
|
||||
"20212223242526272829"
|
||||
"30313233343536373839"
|
||||
"40414243444546474849"
|
||||
"50515253545556575859"
|
||||
"60616263646566676869"
|
||||
"70717273747576777879"
|
||||
"80818283848586878889"
|
||||
"90919293949596979899";
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Internal Functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Decimal */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
|
||||
ZyanStatus ZydisStringAppendDecU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length)
|
||||
{
|
||||
ZYAN_ASSERT(string);
|
||||
ZYAN_ASSERT(!string->vector.allocator);
|
||||
|
||||
char buffer[ZYDIS_MAXCHARS_DEC_32];
|
||||
char *buffer_end = &buffer[ZYDIS_MAXCHARS_DEC_32];
|
||||
char *buffer_write_pointer = buffer_end;
|
||||
while (value >= 100)
|
||||
{
|
||||
const ZyanU32 value_old = value;
|
||||
buffer_write_pointer -= 2;
|
||||
value /= 100;
|
||||
ZYAN_MEMCPY(buffer_write_pointer, &DECIMAL_LOOKUP[(value_old - (value * 100)) * 2], 2);
|
||||
}
|
||||
buffer_write_pointer -= 2;
|
||||
ZYAN_MEMCPY(buffer_write_pointer, &DECIMAL_LOOKUP[value * 2], 2);
|
||||
|
||||
const ZyanUSize offset_odd = (ZyanUSize)(value < 10);
|
||||
const ZyanUSize length_number = buffer_end - buffer_write_pointer - offset_odd;
|
||||
const ZyanUSize length_total = ZYAN_MAX(length_number, padding_length);
|
||||
const ZyanUSize length_target = string->vector.size;
|
||||
|
||||
if (string->vector.size + length_total > string->vector.capacity)
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
ZyanUSize offset_write = 0;
|
||||
if (padding_length > length_number)
|
||||
{
|
||||
offset_write = padding_length - length_number;
|
||||
ZYAN_MEMSET((char*)string->vector.data + length_target - 1, '0', offset_write);
|
||||
}
|
||||
|
||||
ZYAN_MEMCPY((char*)string->vector.data + length_target + offset_write - 1,
|
||||
buffer_write_pointer + offset_odd, length_number);
|
||||
string->vector.size = length_target + length_total;
|
||||
ZYDIS_STRING_NULLTERMINATE(string);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
ZyanStatus ZydisStringAppendDecU64(ZyanString* string, ZyanU64 value, ZyanU8 padding_length)
|
||||
{
|
||||
ZYAN_ASSERT(string);
|
||||
ZYAN_ASSERT(!string->vector.allocator);
|
||||
|
||||
char buffer[ZYDIS_MAXCHARS_DEC_64];
|
||||
char *buffer_end = &buffer[ZYDIS_MAXCHARS_DEC_64];
|
||||
char *buffer_write_pointer = buffer_end;
|
||||
while (value >= 100)
|
||||
{
|
||||
const ZyanU64 value_old = value;
|
||||
buffer_write_pointer -= 2;
|
||||
value /= 100;
|
||||
ZYAN_MEMCPY(buffer_write_pointer, &DECIMAL_LOOKUP[(value_old - (value * 100)) * 2], 2);
|
||||
}
|
||||
buffer_write_pointer -= 2;
|
||||
ZYAN_MEMCPY(buffer_write_pointer, &DECIMAL_LOOKUP[value * 2], 2);
|
||||
|
||||
const ZyanUSize offset_odd = (ZyanUSize)(value < 10);
|
||||
const ZyanUSize length_number = buffer_end - buffer_write_pointer - offset_odd;
|
||||
const ZyanUSize length_total = ZYAN_MAX(length_number, padding_length);
|
||||
const ZyanUSize length_target = string->vector.size;
|
||||
|
||||
if (string->vector.size + length_total > string->vector.capacity)
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
ZyanUSize offset_write = 0;
|
||||
if (padding_length > length_number)
|
||||
{
|
||||
offset_write = padding_length - length_number;
|
||||
ZYAN_MEMSET((char*)string->vector.data + length_target - 1, '0', offset_write);
|
||||
}
|
||||
|
||||
ZYAN_MEMCPY((char*)string->vector.data + length_target + offset_write - 1,
|
||||
buffer_write_pointer + offset_odd, length_number);
|
||||
string->vector.size = length_target + length_total;
|
||||
ZYDIS_STRING_NULLTERMINATE(string);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Hexadecimal */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
|
||||
ZyanStatus ZydisStringAppendHexU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length,
|
||||
ZyanBool force_leading_number, ZyanBool uppercase)
|
||||
{
|
||||
ZYAN_ASSERT(string);
|
||||
ZYAN_ASSERT(!string->vector.allocator);
|
||||
|
||||
const ZyanUSize len = string->vector.size;
|
||||
const ZyanUSize remaining = string->vector.capacity - string->vector.size;
|
||||
|
||||
if (remaining < (ZyanUSize)padding_length)
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
if (!value)
|
||||
{
|
||||
const ZyanU8 n = (padding_length ? padding_length : 1);
|
||||
|
||||
if (remaining < (ZyanUSize)n)
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
ZYAN_MEMSET((char*)string->vector.data + len - 1, '0', n);
|
||||
string->vector.size = len + n;
|
||||
ZYDIS_STRING_NULLTERMINATE(string);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanU8 n = 0;
|
||||
char* buffer = ZYAN_NULL;
|
||||
for (ZyanI8 i = ZYDIS_MAXCHARS_HEX_32 - 1; i >= 0; --i)
|
||||
{
|
||||
const ZyanU8 v = (value >> i * 4) & 0x0F;
|
||||
if (!n)
|
||||
{
|
||||
if (!v)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const ZyanU8 zero = force_leading_number && (v > 9) && (padding_length <= i) ? 1 : 0;
|
||||
if (remaining <= (ZyanUSize)i + zero)
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
buffer = (char*)string->vector.data + len - 1;
|
||||
if (zero)
|
||||
{
|
||||
buffer[n++] = '0';
|
||||
}
|
||||
if (padding_length > i)
|
||||
{
|
||||
n = padding_length - i - 1;
|
||||
ZYAN_MEMSET(buffer, '0', n);
|
||||
}
|
||||
}
|
||||
ZYAN_ASSERT(buffer);
|
||||
if (uppercase)
|
||||
{
|
||||
buffer[n++] = "0123456789ABCDEF"[v];
|
||||
} else
|
||||
{
|
||||
buffer[n++] = "0123456789abcdef"[v];
|
||||
}
|
||||
}
|
||||
string->vector.size = len + n;
|
||||
ZYDIS_STRING_NULLTERMINATE(string);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
ZyanStatus ZydisStringAppendHexU64(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
|
||||
ZyanBool force_leading_number, ZyanBool uppercase)
|
||||
{
|
||||
ZYAN_ASSERT(string);
|
||||
ZYAN_ASSERT(!string->vector.allocator);
|
||||
|
||||
const ZyanUSize len = string->vector.size;
|
||||
const ZyanUSize remaining = string->vector.capacity - string->vector.size;
|
||||
|
||||
if (remaining < (ZyanUSize)padding_length)
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
if (!value)
|
||||
{
|
||||
const ZyanU8 n = (padding_length ? padding_length : 1);
|
||||
|
||||
if (remaining < (ZyanUSize)n)
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
ZYAN_MEMSET((char*)string->vector.data + len - 1, '0', n);
|
||||
string->vector.size = len + n;
|
||||
ZYDIS_STRING_NULLTERMINATE(string);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanU8 n = 0;
|
||||
char* buffer = ZYAN_NULL;
|
||||
for (ZyanI8 i = ((value & 0xFFFFFFFF00000000) ?
|
||||
ZYDIS_MAXCHARS_HEX_64 : ZYDIS_MAXCHARS_HEX_32) - 1; i >= 0; --i)
|
||||
{
|
||||
const ZyanU8 v = (value >> i * 4) & 0x0F;
|
||||
if (!n)
|
||||
{
|
||||
if (!v)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const ZyanU8 zero = force_leading_number && (v > 9) && (padding_length <= i) ? 1 : 0;
|
||||
if (remaining <= (ZyanUSize)i + zero)
|
||||
{
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
buffer = (char*)string->vector.data + len - 1;
|
||||
if (zero)
|
||||
{
|
||||
buffer[n++] = '0';
|
||||
}
|
||||
if (padding_length > i)
|
||||
{
|
||||
n = padding_length - i - 1;
|
||||
ZYAN_MEMSET(buffer, '0', n);
|
||||
}
|
||||
}
|
||||
ZYAN_ASSERT(buffer);
|
||||
if (uppercase)
|
||||
{
|
||||
buffer[n++] = "0123456789ABCDEF"[v];
|
||||
} else
|
||||
{
|
||||
buffer[n++] = "0123456789abcdef"[v];
|
||||
}
|
||||
}
|
||||
string->vector.size = len + n;
|
||||
ZYDIS_STRING_NULLTERMINATE(string);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Public Functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Formatting */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
ZyanStatus ZydisStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
|
||||
const ZyanStringView* prefix, const ZyanStringView* suffix)
|
||||
{
|
||||
if (prefix)
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppend(string, prefix));
|
||||
}
|
||||
|
||||
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64)
|
||||
ZYAN_CHECK(ZydisStringAppendDecU64(string, value, padding_length));
|
||||
#else
|
||||
if (value & 0xFFFFFFFF00000000)
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppendDecU64(string, value, padding_length));
|
||||
}
|
||||
ZYAN_CHECK(ZydisStringAppendDecU32(string, (ZyanU32)value, padding_length));
|
||||
#endif
|
||||
|
||||
if (suffix)
|
||||
{
|
||||
return ZydisStringAppend(string, suffix);
|
||||
}
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
|
||||
ZyanBool force_leading_number, ZyanBool uppercase, const ZyanStringView* prefix,
|
||||
const ZyanStringView* suffix)
|
||||
{
|
||||
if (prefix)
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppend(string, prefix));
|
||||
}
|
||||
|
||||
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64)
|
||||
ZYAN_CHECK(ZydisStringAppendHexU64(string, value, padding_length, force_leading_number,
|
||||
uppercase));
|
||||
#else
|
||||
if (value & 0xFFFFFFFF00000000)
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppendHexU64(string, value, padding_length, force_leading_number,
|
||||
uppercase));
|
||||
}
|
||||
else
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppendHexU32(string, (ZyanU32)value, padding_length,
|
||||
force_leading_number, uppercase));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (suffix)
|
||||
{
|
||||
return ZydisStringAppend(string, suffix);
|
||||
}
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
171
dep/zydis/src/Utils.c
Normal file
171
dep/zydis/src/Utils.c
Normal file
@ -0,0 +1,171 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zycore/LibC.h>
|
||||
#include <Zydis/Utils.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Address calculation */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
// Signed integer overflow is expected behavior in this function, for wrapping around the
|
||||
// instruction pointer on jumps right at the end of the address space.
|
||||
ZYAN_NO_SANITIZE("signed-integer-overflow")
|
||||
ZyanStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||
const ZydisDecodedOperand* operand, ZyanU64 runtime_address, ZyanU64* result_address)
|
||||
{
|
||||
if (!instruction || !operand || !result_address)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
switch (operand->type)
|
||||
{
|
||||
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||
if (!operand->mem.disp.has_displacement)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
if (operand->mem.base == ZYDIS_REGISTER_EIP)
|
||||
{
|
||||
*result_address = ((ZyanU32)runtime_address + instruction->length +
|
||||
(ZyanU32)operand->mem.disp.value);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
if (operand->mem.base == ZYDIS_REGISTER_RIP)
|
||||
{
|
||||
*result_address = (ZyanU64)(runtime_address + instruction->length +
|
||||
operand->mem.disp.value);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
if ((operand->mem.base == ZYDIS_REGISTER_NONE) &&
|
||||
(operand->mem.index == ZYDIS_REGISTER_NONE))
|
||||
{
|
||||
switch (instruction->address_width)
|
||||
{
|
||||
case 16:
|
||||
*result_address = (ZyanU64)operand->mem.disp.value & 0x000000000000FFFF;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
case 32:
|
||||
*result_address = (ZyanU64)operand->mem.disp.value & 0x00000000FFFFFFFF;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
case 64:
|
||||
*result_address = (ZyanU64)operand->mem.disp.value;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||
if (operand->imm.is_signed && operand->imm.is_relative)
|
||||
{
|
||||
*result_address = (ZyanU64)((ZyanI64)runtime_address + instruction->length +
|
||||
operand->imm.value.s);
|
||||
switch (instruction->machine_mode)
|
||||
{
|
||||
case ZYDIS_MACHINE_MODE_LONG_COMPAT_16:
|
||||
case ZYDIS_MACHINE_MODE_LEGACY_16:
|
||||
case ZYDIS_MACHINE_MODE_REAL_16:
|
||||
case ZYDIS_MACHINE_MODE_LONG_COMPAT_32:
|
||||
case ZYDIS_MACHINE_MODE_LEGACY_32:
|
||||
// `XBEGIN` is a special case as it doesn't truncate computed address
|
||||
// This behavior is documented by Intel (SDM Vol. 2C):
|
||||
// Use of the 16-bit operand size does not cause this address to be truncated to
|
||||
// 16 bits, unlike a near jump to a relative offset.
|
||||
if ((instruction->operand_width == 16) &&
|
||||
(instruction->mnemonic != ZYDIS_MNEMONIC_XBEGIN))
|
||||
{
|
||||
*result_address &= 0xFFFF;
|
||||
}
|
||||
break;
|
||||
case ZYDIS_MACHINE_MODE_LONG_64:
|
||||
break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisCalcAbsoluteAddressEx(const ZydisDecodedInstruction* instruction,
|
||||
const ZydisDecodedOperand* operand, ZyanU64 runtime_address,
|
||||
const ZydisRegisterContext* register_context, ZyanU64* result_address)
|
||||
{
|
||||
// TODO: Test this with AGEN/MIB operands
|
||||
// TODO: Add support for Gather/Scatter instructions
|
||||
|
||||
if (!instruction || !operand || !register_context || !result_address)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if ((operand->type != ZYDIS_OPERAND_TYPE_MEMORY) ||
|
||||
((operand->mem.base == ZYDIS_REGISTER_NONE) &&
|
||||
(operand->mem.index == ZYDIS_REGISTER_NONE)) ||
|
||||
(operand->mem.base == ZYDIS_REGISTER_EIP) ||
|
||||
(operand->mem.base == ZYDIS_REGISTER_RIP))
|
||||
{
|
||||
return ZydisCalcAbsoluteAddress(instruction, operand, runtime_address, result_address);
|
||||
}
|
||||
|
||||
ZyanU64 value = operand->mem.disp.value;
|
||||
if (operand->mem.base)
|
||||
{
|
||||
value += register_context->values[operand->mem.base];
|
||||
}
|
||||
if (operand->mem.index)
|
||||
{
|
||||
value += register_context->values[operand->mem.index] * operand->mem.scale;
|
||||
}
|
||||
|
||||
switch (instruction->address_width)
|
||||
{
|
||||
case 16:
|
||||
*result_address = value & 0x000000000000FFFF;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
case 32:
|
||||
*result_address = value & 0x00000000FFFFFFFF;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
case 64:
|
||||
*result_address = value;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
86
dep/zydis/src/Zydis.c
Normal file
86
dep/zydis/src/Zydis.c
Normal file
@ -0,0 +1,86 @@
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Library (Zydis)
|
||||
|
||||
Original Author : Florian Bernd
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/Zydis.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
ZyanU64 ZydisGetVersion(void)
|
||||
{
|
||||
return ZYDIS_VERSION;
|
||||
}
|
||||
|
||||
ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature)
|
||||
{
|
||||
switch (feature)
|
||||
{
|
||||
case ZYDIS_FEATURE_DECODER:
|
||||
#ifndef ZYDIS_DISABLE_DECODER
|
||||
return ZYAN_STATUS_TRUE;
|
||||
#else
|
||||
return ZYAN_STATUS_FALSE;
|
||||
#endif
|
||||
case ZYDIS_FEATURE_ENCODER:
|
||||
#ifndef ZYDIS_DISABLE_ENCODER
|
||||
return ZYAN_STATUS_TRUE;
|
||||
#else
|
||||
return ZYAN_STATUS_FALSE;
|
||||
#endif
|
||||
case ZYDIS_FEATURE_FORMATTER:
|
||||
#ifndef ZYDIS_DISABLE_FORMATTER
|
||||
return ZYAN_STATUS_TRUE;
|
||||
#else
|
||||
return ZYAN_STATUS_FALSE;
|
||||
#endif
|
||||
case ZYDIS_FEATURE_AVX512:
|
||||
#ifndef ZYDIS_DISABLE_AVX512
|
||||
return ZYAN_STATUS_TRUE;
|
||||
#else
|
||||
return ZYAN_STATUS_FALSE;
|
||||
#endif
|
||||
|
||||
case ZYDIS_FEATURE_KNC:
|
||||
#ifndef ZYDIS_DISABLE_KNC
|
||||
return ZYAN_STATUS_TRUE;
|
||||
#else
|
||||
return ZYAN_STATUS_FALSE;
|
||||
#endif
|
||||
|
||||
case ZYDIS_FEATURE_SEGMENT:
|
||||
#ifndef ZYDIS_DISABLE_SEGMENT
|
||||
return ZYAN_STATUS_TRUE;
|
||||
#else
|
||||
return ZYAN_STATUS_FALSE;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
Reference in New Issue
Block a user