repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeXOP
static ZyanStatus ZydisDecodeXOP(ZydisDecoderContext* context, ZydisDecodedInstruction* instruction, const ZyanU8 data[3]) { ZYAN_ASSERT(instruction); ZYAN_ASSERT(data[0] == 0x8F); ZYAN_ASSERT(((data[1] >> 0) & 0x1F) >= 8); ZYAN_ASSERT(instruction->raw.xop.offset == instruction->length - 3); if...
/** * Decodes the `XOP`-prefix. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param data The `XOP` bytes. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L402-L443
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeVEX
static ZyanStatus ZydisDecodeVEX(ZydisDecoderContext* context, ZydisDecodedInstruction* instruction, const ZyanU8 data[3]) { ZYAN_ASSERT(instruction); ZYAN_ASSERT((data[0] == 0xC4) || (data[0] == 0xC5)); if (instruction->machine_mode == ZYDIS_MACHINE_MODE_REAL_16) { // VEX is invalid in 16-...
/** * Decodes the `VEX`-prefix. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param data The `VEX` bytes. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L454-L518
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeEVEX
static ZyanStatus ZydisDecodeEVEX(ZydisDecoderContext* context, ZydisDecodedInstruction* instruction, const ZyanU8 data[4]) { ZYAN_ASSERT(instruction); ZYAN_ASSERT(data[0] == 0x62); ZYAN_ASSERT(instruction->raw.evex.offset == instruction->length - 4); if (instruction->machine_mode == ZYDIS_MACHINE_...
/** * Decodes the `EVEX`-prefix. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param data The `EVEX` bytes. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L530-L612
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeMVEX
static ZyanStatus ZydisDecodeMVEX(ZydisDecoderContext* context, ZydisDecodedInstruction* instruction, const ZyanU8 data[4]) { ZYAN_ASSERT(instruction); ZYAN_ASSERT(data[0] == 0x62); ZYAN_ASSERT(instruction->raw.mvex.offset == instruction->length - 4); if (instruction->machine_mode != ZYDIS_MACHINE_...
/** * Decodes the `MVEX`-prefix. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param data The `MVEX` bytes. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L625-L674
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeModRM
static void ZydisDecodeModRM(ZydisDecodedInstruction* instruction, ZyanU8 data) { ZYAN_ASSERT(instruction); ZYAN_ASSERT(!(instruction->attributes & ZYDIS_ATTRIB_HAS_MODRM)); ZYAN_ASSERT(instruction->raw.modrm.offset == instruction->length - 1); instruction->attributes |= ZYDIS_ATTRIB_HAS_MODRM; i...
/** * Decodes the `ModRM`-byte. * * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param data The `ModRM` byte. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L683-L693
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeSIB
static void ZydisDecodeSIB(ZydisDecodedInstruction* instruction, ZyanU8 data) { ZYAN_ASSERT(instruction); ZYAN_ASSERT(instruction->attributes & ZYDIS_ATTRIB_HAS_MODRM); ZYAN_ASSERT(instruction->raw.modrm.rm == 4); ZYAN_ASSERT(!(instruction->attributes & ZYDIS_ATTRIB_HAS_SIB)); ZYAN_ASSERT(instructio...
/** * Decodes the `SIB`-byte. * * @param instruction A pointer to the `ZydisDecodedInstruction` struct * @param data The `SIB` byte. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L701-L713
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisReadDisplacement
static ZyanStatus ZydisReadDisplacement(ZydisDecoderState* state, ZydisDecodedInstruction* instruction, ZyanU8 size) { ZYAN_ASSERT(state); ZYAN_ASSERT(instruction); ZYAN_ASSERT(instruction->raw.disp.size == 0); instruction->raw.disp.size = size; instruction->raw.disp.offset = instruction->lengt...
/* ---------------------------------------------------------------------------------------------- */ /** * Reads a displacement value. * * @param state A pointer to the `ZydisDecoderState` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param size The physical ...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L726-L773
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisReadImmediate
static ZyanStatus ZydisReadImmediate(ZydisDecoderState* state, ZydisDecodedInstruction* instruction, ZyanU8 id, ZyanU8 size, ZyanBool is_signed, ZyanBool is_relative) { ZYAN_ASSERT(state); ZYAN_ASSERT(instruction); ZYAN_ASSERT((id == 0) || (id == 1)); ZYAN_ASSERT(is_signed || !is_relative); ...
/** * Reads an immediate value. * * @param state A pointer to the `ZydisDecoderState` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param id The immediate id (either `0` or `1`). * @param size The physical size of the immediate value. * @param ...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L787-L862
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisCalcRegisterId
static ZyanU8 ZydisCalcRegisterId(const ZydisDecoderContext* context, const ZydisDecodedInstruction* instruction, ZydisRegisterEncoding encoding, ZydisRegisterClass register_class) { ZYAN_ASSERT(context); ZYAN_ASSERT(instruction); // TODO: Combine OPCODE and IS4 in `ZydisPopulateRegisterIds` and ge...
/** * Calculates the register-id for a specific register-encoding and register-class. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the ` ZydisDecodedInstruction` struct. * @param encoding The register-encoding. * @param register_cla...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L882-L951
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisSetOperandSizeAndElementInfo
static void ZydisSetOperandSizeAndElementInfo(const ZydisDecoderContext* context, const ZydisDecodedInstruction* instruction, ZydisDecodedOperand* operand, const ZydisOperandDefinition* definition) { ZYAN_ASSERT(context); ZYAN_ASSERT(instruction); ZYAN_ASSERT(operand); ZYAN_ASSERT(definition); ...
/** * Sets the operand-size and element-specific information for the given operand. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param operand A pointer to the `ZydisDecodedOperand` struct. * ...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L963-L1204
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeOperandRegister
static ZyanStatus ZydisDecodeOperandRegister(const ZydisDecodedInstruction* instruction, ZydisDecodedOperand* operand, ZydisRegisterClass register_class, ZyanU8 register_id) { ZYAN_ASSERT(instruction); ZYAN_ASSERT(operand); operand->type = ZYDIS_OPERAND_TYPE_REGISTER; if (register_class == ZYDIS_R...
/** * Decodes an register-operand. * * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param operand A pointer to the `ZydisDecodedOperand` struct. * @param register_class The register class. * @param register_id The register id. * * @return A zyan status c...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L1218-L1246
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeOperandMemory
static ZyanStatus ZydisDecodeOperandMemory(const ZydisDecoderContext* context, const ZydisDecodedInstruction* instruction, ZydisDecodedOperand* operand, ZydisRegisterClass vidx_register_class) { ZYAN_ASSERT(context); ZYAN_ASSERT(instruction); ZYAN_ASSERT(operand); ZYAN_ASSERT(instruction->attrib...
/** * Decodes a memory operand. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param operand A pointer to the `ZydisDecodedOperand` struct. * @param vidx_register_class The registe...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L1261-L1440
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeOperandImplicitRegister
static void ZydisDecodeOperandImplicitRegister(const ZydisDecoder* decoder, const ZydisDecoderContext* context, const ZydisDecodedInstruction* instruction, ZydisDecodedOperand* operand, const ZydisOperandDefinition* definition) { ZYAN_ASSERT(context); ZYAN_ASSERT(instruction); ZYAN_ASSERT(operand); ...
/** * Decodes an implicit register operand. * * @param decoder A pointer to the `ZydisDecoder` instance. * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param operand A pointer to the `Zy...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L1453-L1514
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeOperandImplicitMemory
static void ZydisDecodeOperandImplicitMemory(const ZydisDecoder* decoder, const ZydisDecoderContext* context, const ZydisDecodedInstruction* instruction, ZydisDecodedOperand* operand, const ZydisOperandDefinition* definition) { ZYAN_ASSERT(context); ZYAN_ASSERT(operand); ZYAN_ASSERT(definition); ...
/** * Decodes an implicit memory operand. * * @param decoder A pointer to the `ZydisDecoder` instance. * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param operand A pointer to the `Zydi...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L1527-L1588
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisSetAttributes
static void ZydisSetAttributes(ZydisDecoderState* state, ZydisDecodedInstruction* instruction, const ZydisInstructionDefinition* definition) { ZYAN_ASSERT(state); ZYAN_ASSERT(instruction); ZYAN_ASSERT(definition); if (definition->cpu_state != ZYDIS_RW_ACTION_NONE) { static const ZydisIn...
/** * Sets attributes for the given instruction. * * @param state A pointer to the `ZydisDecoderState` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param definition A pointer to the `ZydisInstructionDefinition` struct. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L1992-L2261
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisSetAVXInformation
static void ZydisSetAVXInformation(ZydisDecoderContext* context, ZydisDecodedInstruction* instruction, const ZydisInstructionDefinition* definition) { ZYAN_ASSERT(context); ZYAN_ASSERT(instruction); ZYAN_ASSERT(definition); switch (instruction->encoding) { case ZYDIS_INSTRUCTION_ENCODING_XO...
/** * Sets AVX-specific information for the given instruction. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param definition A pointer to the `ZydisInstructionDefinition` struct. * * Information set for `XO...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L2295-L3061
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisCollectOptionalPrefixes
static ZyanStatus ZydisCollectOptionalPrefixes(ZydisDecoderState* state, ZydisDecodedInstruction* instruction) { ZYAN_ASSERT(state); ZYAN_ASSERT(instruction); ZYAN_ASSERT(instruction->raw.prefix_count == 0); ZyanU8 rex = 0x00; ZyanU8 offset = 0; ZyanBool done = ZYAN_FALSE; do { ...
/* ---------------------------------------------------------------------------------------------- */ /* Physical instruction decoding */ /* ---------------------------------------------------------------------------------------------- */ /** * Collects o...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L3079-L3199
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeOptionalInstructionParts
static ZyanStatus ZydisDecodeOptionalInstructionParts(ZydisDecoderState* state, ZydisDecodedInstruction* instruction, const ZydisInstructionEncodingInfo* info) { ZYAN_ASSERT(state); ZYAN_ASSERT(instruction); ZYAN_ASSERT(info); ZydisDecoderContext* context = state->context; if (info->flags & ZY...
/** * Decodes optional instruction parts like the ModRM byte, the SIB byte and * additional displacements and/or immediate values. * * @param state A pointer to the `ZydisDecoderState` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param info A pointer to the...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L3211-L3335
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisSetEffectiveOperandWidth
static void ZydisSetEffectiveOperandWidth(ZydisDecoderContext* context, ZydisDecodedInstruction* instruction, const ZydisInstructionDefinition* definition) { ZYAN_ASSERT(context); ZYAN_ASSERT(instruction); ZYAN_ASSERT(definition); static const ZyanU8 operand_size_map[8][8] = { // Defaul...
/* ---------------------------------------------------------------------------------------------- */ /** * Sets the effective operand size for the given instruction. * * @param context A pointer to the `ZydisDecoderContext` struct * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @p...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L3346-L3469
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisSetEffectiveAddressWidth
static void ZydisSetEffectiveAddressWidth(ZydisDecoderContext* context, ZydisDecodedInstruction* instruction, const ZydisInstructionDefinition* definition) { ZYAN_ASSERT(context); ZYAN_ASSERT(instruction); static const ZyanU8 address_size_map[3][8] = { // Default for most instructions ...
/** * Sets the effective address width for the given instruction. * * @param context A pointer to the `ZydisDecoderContext` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param definition A pointer to the `ZydisInstructionDefinition` struct. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L3478-L3532
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisNodeHandlerXOP
static ZyanStatus ZydisNodeHandlerXOP(const ZydisDecodedInstruction* instruction, ZyanU16* index) { ZYAN_ASSERT(instruction); ZYAN_ASSERT(index); switch (instruction->encoding) { case ZYDIS_INSTRUCTION_ENCODING_LEGACY: *index = 0; break; case ZYDIS_INSTRUCTION_ENCODING_XOP: ...
/* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L3536-L3554
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisPopulateRegisterIds
static ZyanStatus ZydisPopulateRegisterIds(ZydisDecoderContext* context, const ZydisDecodedInstruction* instruction, ZyanU8 def_reg, ZyanU8 def_rm, ZyanU8 def_ndsndd) { ZYAN_ASSERT(context); ZYAN_ASSERT(instruction); const ZyanBool is_64_bit = (instruction->machine_mode == ZYDIS_MACHINE_MODE_LONG_64); ...
/* ---------------------------------------------------------------------------------------------- */ /** * Populates the internal register id fields for `REG`, `RM`, `NDSNDD`, `BASE` and `INDEX`/`VIDX` * encoded operands and performs sanity checks. * * @param context A pointer to the `ZydisDecoderContext` str...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L4152-L4332
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisCheckErrorConditions
static ZyanStatus ZydisCheckErrorConditions(ZydisDecoderState* state, const ZydisDecodedInstruction* instruction, const ZydisInstructionDefinition* definition) { ZYAN_ASSERT(state); ZYAN_ASSERT(instruction); ZYAN_ASSERT(definition); ZyanU8 def_reg = definition->op_reg; ZyanU8 d...
/** * Checks for certain post-decode error-conditions. * * @param state A pointer to the `ZydisDecoderState` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * @param definition A pointer to the `ZydisInstructionDefinition` struct. * * @return A zyan status code. * ...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L4345-L4660
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecodeInstruction
static ZyanStatus ZydisDecodeInstruction(ZydisDecoderState* state, ZydisDecodedInstruction* instruction) { ZYAN_ASSERT(state); ZYAN_ASSERT(instruction); // Iterate through the decoder tree const ZydisDecoderTreeNode* node = ZydisDecoderTreeGetRootNode(); const ZydisDecoderTreeNode* temp = ZYAN_...
/* ---------------------------------------------------------------------------------------------- */ /** * Uses the decoder-tree to decode the current instruction. * * @param state A pointer to the `ZydisDecoderState` struct. * @param instruction A pointer to the `ZydisDecodedInstruction` struct. * * @r...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L4672-L4887
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisDecoderInit
ZyanStatus ZydisDecoderInit(ZydisDecoder* decoder, ZydisMachineMode machine_mode, ZydisStackWidth stack_width) { static const ZyanBool decoder_modes[ZYDIS_DECODER_MODE_MAX_VALUE + 1] = { #ifdef ZYDIS_MINIMAL_MODE ZYAN_TRUE , // ZYDIS_DECODER_MODE_MINIMAL #else ZYAN_FALSE, // ZYDIS_DECODER_MO...
/* ---------------------------------------------------------------------------------------------- */ /* ============================================================================================== */ /* Exported functions */ /* ==============...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Decoder.c#L4895-L4946
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetEncodableEncoding
ZydisEncodableEncoding ZydisGetEncodableEncoding(ZydisInstructionEncoding encoding) { static const ZydisEncodableEncoding encoding_lookup[6] = { ZYDIS_ENCODABLE_ENCODING_LEGACY, ZYDIS_ENCODABLE_ENCODING_3DNOW, ZYDIS_ENCODABLE_ENCODING_XOP, ZYDIS_ENCODABLE_ENCODING_VEX, ZY...
/* ============================================================================================== */ /* Internal functions */ /* ============================================================================================== */ /** * Converts `...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L265-L278
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetMachineModeWidth
ZyanU8 ZydisGetMachineModeWidth(ZydisMachineMode machine_mode) { switch (machine_mode) { case ZYDIS_MACHINE_MODE_REAL_16: case ZYDIS_MACHINE_MODE_LEGACY_16: case ZYDIS_MACHINE_MODE_LONG_COMPAT_16: return 16; case ZYDIS_MACHINE_MODE_LEGACY_32: case ZYDIS_MACHINE_MODE_LONG_COMPAT_32: ...
/** * Converts `ZydisMachineMode` to default stack width value expressed in bits. * * @param machine_mode `ZydisMachineMode` value to convert. * * @return Stack width for requested machine mode. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L287-L303
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetAszFromHint
ZyanU8 ZydisGetAszFromHint(ZydisAddressSizeHint hint) { switch (hint) { case ZYDIS_ADDRESS_SIZE_HINT_NONE: return 0; case ZYDIS_ADDRESS_SIZE_HINT_16: return 16; case ZYDIS_ADDRESS_SIZE_HINT_32: return 32; case ZYDIS_ADDRESS_SIZE_HINT_64: return 64; default: ...
/** * Converts `ZydisAddressSizeHint` to address size expressed in bits. * * @param hint Address size hint. * * @return Address size in bits. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L312-L327
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetOszFromHint
ZyanU8 ZydisGetOszFromHint(ZydisOperandSizeHint hint) { switch (hint) { case ZYDIS_OPERAND_SIZE_HINT_NONE: return 0; case ZYDIS_OPERAND_SIZE_HINT_8: return 8; case ZYDIS_OPERAND_SIZE_HINT_16: return 16; case ZYDIS_OPERAND_SIZE_HINT_32: return 32; case ZYDIS_OP...
/** * Converts `ZydisOperandSizeHint` to operand size expressed in bits. * * @param hint Operand size hint. * * @return Operand size in bits. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L336-L353
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetOperandSizeFromElementSize
ZyanU8 ZydisGetOperandSizeFromElementSize(ZydisEncoderInstructionMatch *match, const ZyanU16 *size_table, ZyanU16 desired_size, ZyanBool exact_match_mode) { if ((match->base_definition->operand_size_map == ZYDIS_OPSIZE_MAP_DEFAULT64) && (match->request->machine_mode == ZYDIS_MACHINE_MODE_LONG_64)) {...
/** * Calculates effective operand size. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param size_table Array of possible size values for different operand sizes. * @param desired_size Operand size requested by caller. * @param exact_match_mode True if desire...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L366-L415
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetScaledImmSize
ZyanU8 ZydisGetScaledImmSize(ZydisEncoderInstructionMatch *match, const ZyanU16 *size_table, ZyanU8 min_imm_size) { if (match->eosz == 0) { match->eosz = ZydisGetOperandSizeFromElementSize(match, size_table, min_imm_size, ZYAN_FALSE); return match->eosz != 0 ? (ZyanU8)size_table[...
/** * Calculates effective immediate size. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param size_table Array of possible size values for different operand sizes. * @param min_imm_size Minimum immediate size. * * @return Effective operand size in bits. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L426-L438
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetSignedImmSize
ZyanU8 ZydisGetSignedImmSize(ZyanI64 imm) { if (imm >= ZYAN_INT8_MIN && imm <= ZYAN_INT8_MAX) { return 8; } if (imm >= ZYAN_INT16_MIN && imm <= ZYAN_INT16_MAX) { return 16; } if (imm >= ZYAN_INT32_MIN && imm <= ZYAN_INT32_MAX) { return 32; } return 64; }
/** * Calculates size of smallest integral type able to represent provided signed value. * * @param imm Immediate to be represented. * * @return Size of smallest integral type able to represent provided signed value. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L447-L463
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetUnsignedImmSize
ZyanU8 ZydisGetUnsignedImmSize(ZyanU64 imm) { if (imm <= ZYAN_UINT8_MAX) { return 8; } if (imm <= ZYAN_UINT16_MAX) { return 16; } if (imm <= ZYAN_UINT32_MAX) { return 32; } return 64; }
/** * Calculates size of smallest integral type able to represent provided unsigned value. * * @param imm Immediate to be represented. * * @return Size of smallest integral type able to represent provided unsigned value. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L472-L488
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsImmSigned
ZyanBool ZydisIsImmSigned(ZydisOperandEncoding encoding) { switch (encoding) { case ZYDIS_OPERAND_ENCODING_SIMM8: case ZYDIS_OPERAND_ENCODING_SIMM16: case ZYDIS_OPERAND_ENCODING_SIMM32: case ZYDIS_OPERAND_ENCODING_SIMM64: case ZYDIS_OPERAND_ENCODING_SIMM16_32_64: case ZYDIS_OPERAND_ENCOD...
/** * Checks if operand encoding encodes a signed immediate value. * * @param encoding Operand encoding for immediate value. * * @return True for encodings that represent signed values, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L497-L535
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetEffectiveImmSize
ZyanU8 ZydisGetEffectiveImmSize(ZydisEncoderInstructionMatch *match, ZyanI64 imm, const ZydisOperandDefinition *def_op) { ZyanU8 eisz = 0; ZyanU8 min_size = ZydisIsImmSigned((ZydisOperandEncoding)def_op->op.encoding) ? ZydisGetSignedImmSize(imm) : ZydisGetUnsignedImmSize((ZyanU64)imm); ...
/** * Calculates effective immediate size. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param imm Immediate value to encode. * @param def_op Operand definition for immediate operand. * * @return Effective operand size in bits (0 if function failed). */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L546-L659
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisCheckOsz
ZyanBool ZydisCheckOsz(ZydisEncoderInstructionMatch *match, ZydisRegisterWidth reg_width) { ZYAN_ASSERT(reg_width <= ZYAN_UINT8_MAX); if (match->eosz == 0) { if (reg_width == 8) { return ZYAN_FALSE; } match->eosz = (ZyanU8)reg_width; return ZYAN_TRUE; ...
/** * Checks if register width is compatible with effective operand size. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param reg_width Register width in bits. * * @return True if width is compatible, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L669-L683
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisCheckAsz
ZyanBool ZydisCheckAsz(ZydisEncoderInstructionMatch *match, ZydisRegisterWidth reg_width) { ZYAN_ASSERT(reg_width <= ZYAN_UINT8_MAX); if (match->easz == 0) { if ((match->request->machine_mode == ZYDIS_MACHINE_MODE_LONG_64) && (reg_width == 16)) { return ZYAN_FALSE; ...
/** * Checks if register width is compatible with effective address size. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param reg_width Register width in bits. * * @return True if width is compatible, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L693-L708
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsRegisterAllowed
ZyanBool ZydisIsRegisterAllowed(ZydisEncoderInstructionMatch *match, ZydisRegister reg, ZydisRegisterClass reg_class) { const ZyanI8 reg_id = ZydisRegisterGetId(reg); ZYAN_ASSERT(reg_id >= 0 && reg_id <= 31); if (match->request->machine_mode == ZYDIS_MACHINE_MODE_LONG_64) { if ((match->defin...
/** * Checks if specified register is valid for provided register class, encoding and machine mode. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param reg `ZydisRegister` value. * @param reg_class Register class. * * @return True if register value is allowed, fal...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L719-L747
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsScaleValid
ZyanBool ZydisIsScaleValid(ZyanU8 scale) { switch (scale) { case 0: case 1: case 2: case 4: case 8: return ZYAN_TRUE; default: return ZYAN_FALSE; } }
/** * Checks if specified scale value is valid for use with SIB addressing. * * @param scale Scale value. * * @return True if value is valid, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L756-L769
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisValidateRexType
ZyanBool ZydisValidateRexType(ZydisEncoderInstructionMatch *match, ZydisRegister reg, ZyanBool addressing_mode) { switch (reg) { case ZYDIS_REGISTER_AL: case ZYDIS_REGISTER_CL: case ZYDIS_REGISTER_DL: case ZYDIS_REGISTER_BL: return ZYAN_TRUE; case ZYDIS_REGISTER_AH: case ZYDI...
/** * Enforces register usage constraints associated with usage of `REX` prefix. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param reg `ZydisRegister` value. * @param addressing_mode True if checked address is used for address calculations. This ...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L781-L842
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsValidAddressingClass
ZyanBool ZydisIsValidAddressingClass(ZydisEncoderInstructionMatch *match, ZydisRegisterClass reg_class, ZydisRegister reg) { ZyanBool result; const ZyanBool is_64 = (match->request->machine_mode == ZYDIS_MACHINE_MODE_LONG_64); switch (reg_class) { case ZYDIS_REGCLASS_INVALID: return ZYAN...
/** * Checks if specified register is valid for use with SIB addressing. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param reg_class Register class. * @param reg `ZydisRegister` value. * * @return True if register value is allowed, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L853-L876
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetRm16
ZyanI8 ZydisGetRm16(ZydisRegister base, ZydisRegister index) { static const ZydisRegister modrm16_lookup[8][2] = { { ZYDIS_REGISTER_BX, ZYDIS_REGISTER_SI }, { ZYDIS_REGISTER_BX, ZYDIS_REGISTER_DI }, { ZYDIS_REGISTER_BP, ZYDIS_REGISTER_SI }, { ZYDIS_REGISTER_BP, ZYDIS_REGISTER_DI ...
/** * Helper function that determines correct `ModR/M.RM` value for 16-bit addressing mode. * * @param base `ZydisRegister` used as `SIB.base`. * @param index `ZydisRegister` used as `SIB.index`. * * @return `ModR/M.RM` value (-1 if function failed). */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L886-L909
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEncodeMvexBroadcastMode
ZyanU8 ZydisEncodeMvexBroadcastMode(ZydisBroadcastMode broadcast) { switch (broadcast) { case ZYDIS_BROADCAST_MODE_INVALID: return 0; case ZYDIS_BROADCAST_MODE_1_TO_16: case ZYDIS_BROADCAST_MODE_1_TO_8: return 1; case ZYDIS_BROADCAST_MODE_4_TO_16: case ZYDIS_BROADCAST_MODE_4_...
/** * Encodes `MVEX.sss` field for specified broadcast mode. * * @param broadcast Broadcast mode. * * @return Corresponding `MVEX.sss` value. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L918-L933
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEncodeMvexConversionMode
ZyanU8 ZydisEncodeMvexConversionMode(ZydisConversionMode conversion) { switch (conversion) { case ZYDIS_CONVERSION_MODE_INVALID: return 0; case ZYDIS_CONVERSION_MODE_FLOAT16: return 3; case ZYDIS_CONVERSION_MODE_UINT8: return 4; case ZYDIS_CONVERSION_MODE_SINT8: r...
/** * Encodes `MVEX.sss` field for specified conversion mode. * * @param conversion Conversion mode. * * @return Corresponding `MVEX.sss` value. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L942-L961
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetCompDispScaleEvex
ZyanU8 ZydisGetCompDispScaleEvex(const ZydisEncoderInstructionMatch *match) { const ZydisInstructionDefinitionEVEX *evex_def = (const ZydisInstructionDefinitionEVEX *)match->base_definition; ZYAN_ASSERT(match->definition->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX); ZYAN_ASSERT(evex_def->tuple_typ...
/** * Determines scale factor for compressed 8-bit displacement (`EVEX` instructions only). * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * * @return log2(scale factor) */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L970-L1098
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetCompDispScaleMvex
ZyanU8 ZydisGetCompDispScaleMvex(const ZydisEncoderInstructionMatch *match) { const ZydisInstructionDefinitionMVEX *mvex_def = (const ZydisInstructionDefinitionMVEX *)match->base_definition; ZyanU8 index = mvex_def->has_element_granularity; ZYAN_ASSERT(!index || !mvex_def->broadcast); if (!inde...
/** * Determines scale factor for compressed 8-bit displacement (`MVEX` instructions only). * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * * @return log2(scale factor) */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L1107-L1208
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetCompDispScale
ZyanU8 ZydisGetCompDispScale(const ZydisEncoderInstructionMatch *match) { switch (match->definition->encoding) { case ZYDIS_INSTRUCTION_ENCODING_LEGACY: case ZYDIS_INSTRUCTION_ENCODING_3DNOW: case ZYDIS_INSTRUCTION_ENCODING_XOP: case ZYDIS_INSTRUCTION_ENCODING_VEX: return 0; case ZYD...
/** * Determines scale factor for compressed 8-bit displacement. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * * @return log2(scale factor) */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L1217-L1233
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsRegisterOperandCompatible
ZyanBool ZydisIsRegisterOperandCompatible(ZydisEncoderInstructionMatch *match, const ZydisEncoderOperand *user_op, const ZydisOperandDefinition *def_op) { const ZydisRegisterClass reg_class = ZydisRegisterGetClass(user_op->reg.value); const ZydisRegisterWidth reg_width = ZydisRegisterClassGetWidth(match->re...
/** * Checks if requested operand matches register operand from instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param user_op Operand definition from `ZydisEncoderRequest` structure. * @param def_op Decoder's operand definition from current instr...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L1244-L1565
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsMemoryOperandCompatible
ZyanBool ZydisIsMemoryOperandCompatible(ZydisEncoderInstructionMatch *match, const ZydisEncoderOperand *user_op, const ZydisOperandDefinition *def_op) { switch (def_op->type) { case ZYDIS_SEMANTIC_OPTYPE_MEM: case ZYDIS_SEMANTIC_OPTYPE_AGEN: case ZYDIS_SEMANTIC_OPTYPE_MIB: case ZYDIS_SEMANTI...
/** * Checks if requested operand matches memory operand from instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param user_op Operand definition from `ZydisEncoderRequest` structure. * @param def_op Decoder's operand definition from current instruc...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L1576-L2088
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsPointerOperandCompatible
ZyanBool ZydisIsPointerOperandCompatible(ZydisEncoderInstructionMatch *match, const ZydisEncoderOperand *user_op) { ZYAN_ASSERT(match->eosz == 0); ZYAN_ASSERT(match->request->machine_mode != ZYDIS_MACHINE_MODE_LONG_64); ZYAN_ASSERT((match->request->branch_type == ZYDIS_BRANCH_TYPE_NONE) || ...
/** * Checks if requested operand matches pointer operand from instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param user_op Operand definition from `ZydisEncoderRequest` structure. * * @return True if operands match, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2098-L2116
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsImmediateOperandCompabile
ZyanBool ZydisIsImmediateOperandCompabile(ZydisEncoderInstructionMatch *match, const ZydisEncoderOperand *user_op, const ZydisOperandDefinition *def_op) { switch (def_op->type) { case ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_IMM1: if (user_op->imm.u != 1) { return ZYAN_FALSE; }...
/** * Checks if requested operand matches immediate operand from instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param user_op Operand definition from `ZydisEncoderRequest` structure. * @param def_op Decoder's operand definition from current inst...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2127-L2171
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsBroadcastModeCompatible
ZyanBool ZydisIsBroadcastModeCompatible(const ZydisInstructionDefinitionEVEX *evex_def, ZydisVectorLength vector_length, ZydisBroadcastMode broadcast) { if (broadcast == ZYDIS_BROADCAST_MODE_INVALID) { return ZYAN_TRUE; } ZyanU8 vector_size = 0; ZYAN_ASSERT(vector_length != ZYDIS_VECTOR...
/** * Checks if requested boardcast mode is compatible with instruction definition. * * @param evex_def Definition for `EVEX`-encoded instruction. * @param vector_length Vector length. * @param broadcast Requested broadcast mode. * * @return True if broadcast mode is compatible, false otherwis...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2182-L2265
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisAreEvexFeaturesCompatible
ZyanBool ZydisAreEvexFeaturesCompatible(const ZydisEncoderInstructionMatch *match, const ZydisEncoderRequest *request) { if (match->definition->encoding != ZYDIS_INSTRUCTION_ENCODING_EVEX) { return ZYAN_TRUE; } const ZydisInstructionDefinitionEVEX *evex_def = (const ZydisInstruction...
/** * Checks if requested `EVEX`-specific features are compatible with instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param request A pointer to `ZydisEncoderRequest` struct. * * @return True if features are compatible, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2275-L2346
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisAreMvexFeaturesCompatible
ZyanBool ZydisAreMvexFeaturesCompatible(const ZydisEncoderInstructionMatch *match, const ZydisEncoderRequest *request) { if (match->definition->encoding != ZYDIS_INSTRUCTION_ENCODING_MVEX) { return ZYAN_TRUE; } if (((match->definition->modrm >> 6) == 3) && (request->mvex.eviction_hin...
/** * Checks if requested `MVEX`-specific features are compatible with instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param request A pointer to `ZydisEncoderRequest` struct. * * @return True if features are compatible, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2356-L2555
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisCheckConstraints
ZyanBool ZydisCheckConstraints(const ZydisEncoderInstructionMatch *match) { const ZydisEncoderOperand *operands = match->request->operands; ZyanBool is_gather = ZYAN_FALSE; switch (match->definition->encoding) { case ZYDIS_INSTRUCTION_ENCODING_VEX: { const ZydisInstructionDefinitionVEX *...
/** * Checks if operands specified in encoder request satisfy additional constraints mandated by * matched instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * * @return True if operands passed the checks, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2565-L2663
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisIsDefinitionCompatible
ZyanBool ZydisIsDefinitionCompatible(ZydisEncoderInstructionMatch *match, const ZydisEncoderRequest *request) { ZYAN_ASSERT(request->operand_count == match->base_definition->operand_count_visible); match->operands = ZydisGetOperandDefinitions(match->base_definition); if (!ZydisAreEvexFeaturesCompatible...
/** * Checks if operands and encoding-specific features from `ZydisEncoderRequest` match * encoder's instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param request A pointer to `ZydisEncoderRequest` struct. * * @return True if definition is compatible...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2674-L2775
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisArePrefixesCompatible
ZyanBool ZydisArePrefixesCompatible(const ZydisEncoderInstructionMatch *match) { if ((!match->base_definition->accepts_segment) && (match->attributes & ZYDIS_ATTRIB_HAS_SEGMENT)) { return ZYAN_FALSE; } if (match->definition->encoding != ZYDIS_INSTRUCTION_ENCODING_LEGACY) { re...
/** * Checks if requested set of prefixes is compatible with instruction definition. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2784-L2853
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetOperandMask
ZyanU16 ZydisGetOperandMask(const ZydisEncoderRequest *request) { ZyanU16 operand_mask = request->operand_count; ZyanU8 bit_offset = ZYAN_BITS_TO_REPRESENT(ZYDIS_ENCODER_MAX_OPERANDS); for (ZyanU8 i = 0; i < request->operand_count; ++i) { operand_mask |= (request->operands[i].type - ZYDIS_OPERAN...
/** * Returns operand mask containing information about operand count and types in a compressed form. * * @param request A pointer to `ZydisEncoderRequest` struct. * * @return Operand mask. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2862-L2874
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisHandleSwappableDefinition
ZyanBool ZydisHandleSwappableDefinition(ZydisEncoderInstructionMatch *match) { if (!match->definition->swappable) { return ZYAN_FALSE; } // Special case for ISA-wide unique conflict between two `mov` variants // mov gpr16_32_64(encoding=opcode), imm(encoding=uimm16_32_64,scale_factor=osz) ...
/** * Handles optimization opportunities indicated by `swappable` field in instruction definition * structure. See `ZydisEncodableInstruction` for more information. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * * @return True if definition has been swapped, false otherwise. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2884-L2919
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFindMatchingDefinition
ZyanStatus ZydisFindMatchingDefinition(const ZydisEncoderRequest *request, ZydisEncoderInstructionMatch *match) { ZYAN_MEMSET(match, 0, sizeof(ZydisEncoderInstructionMatch)); match->request = request; match->attributes = request->prefixes; const ZydisEncodableInstruction *definition = ZYAN_NULL; ...
/** * This function attempts to find a matching instruction definition for provided encoder request. * * @param request A pointer to `ZydisEncoderRequest` struct. * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L2929-L3127
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitUInt
ZyanStatus ZydisEmitUInt(ZyanU64 data, ZyanU8 size, ZydisEncoderBuffer *buffer) { ZYAN_ASSERT(size == 1 || size == 2 || size == 4 || size == 8); const ZyanUSize new_offset = buffer->offset + size; if (new_offset > buffer->size) { return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE; } // TODO: ...
/** * Emits unsigned integer value. * * @param data Value to emit. * @param size Value size in bytes. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3138-L3153
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitByte
ZyanStatus ZydisEmitByte(ZyanU8 byte, ZydisEncoderBuffer *buffer) { return ZydisEmitUInt(byte, 1, buffer); }
/** * Emits a single byte. * * @param byte Value to emit. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3163-L3166
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitLegacyPrefixes
ZyanStatus ZydisEmitLegacyPrefixes(const ZydisEncoderInstruction *instruction, ZydisEncoderBuffer *buffer) { ZyanBool compressed_prefixes = ZYAN_FALSE; switch (instruction->encoding) { case ZYDIS_INSTRUCTION_ENCODING_XOP: case ZYDIS_INSTRUCTION_ENCODING_VEX: case ZYDIS_INSTRUCTION_ENCODING_E...
/** * Emits legact prefixes. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3176-L3261
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEncodeRexLowNibble
ZyanU8 ZydisEncodeRexLowNibble(const ZydisEncoderInstruction *instruction, ZyanBool *high_r) { if (high_r) { *high_r = ZYAN_FALSE; } ZyanU8 rex = 0; if ((instruction->attributes & ZYDIS_ATTRIB_HAS_MODRM) && (instruction->attributes & ZYDIS_ATTRIB_HAS_SIB)) { if (instruct...
/** * Encodes low nibble of `REX` prefix. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param high_r A pointer to `ZyanBool` variable that will be set to true when the * highest `ModR/M.reg` bit cannot be encoded using `REX` prefix. * * @return...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3272-L3333
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitRex
ZyanStatus ZydisEmitRex(const ZydisEncoderInstruction *instruction, ZydisEncoderBuffer *buffer) { const ZyanU8 rex = ZydisEncodeRexLowNibble(instruction, ZYAN_NULL); if (rex || (instruction->attributes & ZYDIS_ATTRIB_HAS_REX)) { ZYAN_CHECK(ZydisEmitByte(0x40 | rex, buffer)); } return ZYAN_S...
/** * Emits `REX` prefix. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3343-L3352
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEncodeVexCommons
void ZydisEncodeVexCommons(ZydisEncoderInstruction *instruction, ZyanU8 *mmmmm, ZyanU8 *pp, ZyanU8 *vvvv, ZyanU8 *rex, ZyanBool *high_r) { switch (instruction->opcode_map) { case ZYDIS_OPCODE_MAP_DEFAULT: case ZYDIS_OPCODE_MAP_0F: case ZYDIS_OPCODE_MAP_0F38: case ZYDIS_OPCODE_MAP_0F3A: c...
/** * Encodes common parts of `VEX` prefix. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param mmmmm A pointer to `ZyanU8` variable that will receive `VEX.mmmmm` * @param pp A pointer to `ZyanU8` variable that will receive `VEX.pp` * @param vvvv ...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3365-L3404
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitXop
ZyanStatus ZydisEmitXop(ZydisEncoderInstruction *instruction, ZydisEncoderBuffer *buffer) { ZyanU8 mmmmm, pp, vvvv, rex; ZydisEncodeVexCommons(instruction, &mmmmm, &pp, &vvvv, &rex, ZYAN_NULL); ZYAN_ASSERT(instruction->vector_length <= 1); const ZyanU8 b1 = (((~rex) & 0x07) << 5) | mmmmm; const Zyan...
/** * Emits `XOP` prefix. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3414-L3425
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitVex
ZyanStatus ZydisEmitVex(ZydisEncoderInstruction *instruction, ZydisEncoderBuffer *buffer) { ZyanU8 mmmmm, pp, vvvv, rex; ZydisEncodeVexCommons(instruction, &mmmmm, &pp, &vvvv, &rex, ZYAN_NULL); ZYAN_ASSERT(instruction->vector_length <= 1); if (mmmmm != 1 || (rex & 0x0B)) { const ZyanU8 b1 = ...
/** * Emits `VEX` prefix. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3435-L3462
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEncodeEvexCommons
void ZydisEncodeEvexCommons(ZydisEncoderInstruction *instruction, ZyanU8 *p0, ZyanU8 *p1, ZyanU8 *vvvvv) { ZyanBool high_r; ZyanU8 mmmmm, pp, rex; ZydisEncodeVexCommons(instruction, &mmmmm, &pp, vvvvv, &rex, &high_r); *p0 = (((~rex) & 0x07) << 5) | mmmmm; if (!high_r) { *p0 |= 0x10; ...
/** * Encodes common parts of `EVEX` prefix. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param p0 A pointer to `ZyanU8` variable that will receive 2nd byte of `EVEX` prefix. * @param p1 A pointer to `ZyanU8` variable that will receive 3rd byte of `EVEX` prefix. ...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3472-L3484
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitEvex
ZyanStatus ZydisEmitEvex(ZydisEncoderInstruction *instruction, ZydisEncoderBuffer *buffer) { ZyanU8 p0, p1, vvvvv; ZydisEncodeEvexCommons(instruction, &p0, &p1, &vvvvv); ZyanU8 p2 = (instruction->vector_length << 5) | ((vvvvv & 0x10) >> 1) | instruction->mask; if (instruction->zeroing) { p2 ...
/** * Emits `EVEX` prefix. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3494-L3517
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitMvex
ZyanStatus ZydisEmitMvex(ZydisEncoderInstruction *instruction, ZydisEncoderBuffer *buffer) { ZyanU8 p0, p1, vvvvv; ZydisEncodeEvexCommons(instruction, &p0, &p1, &vvvvv); ZyanU8 p2 = (instruction->sss << 4) | ((vvvvv & 0x10) >> 1) | instruction->mask; if (instruction->eviction_hint) { p2 |= 0...
/** * Emits `MVEX` prefix. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3527-L3546
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEmitInstruction
ZyanStatus ZydisEmitInstruction(ZydisEncoderInstruction *instruction, ZydisEncoderBuffer *buffer) { ZYAN_CHECK(ZydisEmitLegacyPrefixes(instruction, buffer)); switch (instruction->encoding) { case ZYDIS_INSTRUCTION_ENCODING_LEGACY: case ZYDIS_INSTRUCTION_ENCODING_3DNOW: ZYAN_CHECK(ZydisEmitR...
/** * Emits instruction as stream of bytes. * * @param instruction A pointer to `ZydisEncoderInstruction` struct. * @param buffer A pointer to `ZydisEncoderBuffer` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3556-L3637
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisBuildRegisterOperand
void ZydisBuildRegisterOperand(const ZydisEncoderOperand *user_op, const ZydisOperandDefinition *def_op, ZydisEncoderInstruction *instruction) { if (def_op->type == ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG) { return; } ZyanU8 reg_id = 0; if (ZydisRegisterGetClass(user_op->reg.value) != ZYDIS_...
/** * Encodes register operand as fields inside `ZydisEncoderInstruction` structure. * * @param user_op Validated operand definition from `ZydisEncoderRequest` structure. * @param def_op Decoder's operand definition from instruction definition. * @param instruction A pointer to `ZydisEncoderInstruct...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3646-L3703
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisBuildMemoryOperand
void ZydisBuildMemoryOperand(ZydisEncoderInstructionMatch *match, const ZydisEncoderOperand *user_op, ZydisEncoderInstruction *instruction) { instruction->attributes |= ZYDIS_ATTRIB_HAS_MODRM; instruction->disp = (ZyanU64)user_op->mem.displacement; if (match->easz == 16) { const ZyanI8 rm = ...
/** * Encodes memory operand as fields inside `ZydisEncoderInstruction` structure. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param user_op Decoder's operand definition from instruction definition. * @param instruction A pointer to `ZydisEncoderInstruction` struct. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3712-L3848
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisBuildInstruction
ZyanStatus ZydisBuildInstruction(ZydisEncoderInstructionMatch *match, ZydisEncoderInstruction *instruction) { ZYAN_MEMSET(instruction, 0, sizeof(ZydisEncoderInstruction)); instruction->attributes = match->attributes; instruction->encoding = match->definition->encoding; instruction->opcode_map = matc...
/** * Encodes instruction as emittable `ZydisEncoderInstruction` struct. * * @param match A pointer to `ZydisEncoderInstructionMatch` struct. * @param instruction A pointer to `ZydisEncoderInstruction` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L3858-L4100
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEncoderCheckRequestSanity
ZyanStatus ZydisEncoderCheckRequestSanity(const ZydisEncoderRequest *request) { if (((ZyanUSize)request->machine_mode > ZYDIS_MACHINE_MODE_MAX_VALUE) || ((ZyanUSize)request->allowed_encodings > ZYDIS_ENCODABLE_ENCODING_MAX_VALUE) || ((ZyanUSize)request->mnemonic > ZYDIS_MNEMONIC_MAX_VALUE) || ...
/** * Performs a set of sanity checks that must be satisfied for every valid encoder request. * * @param request A pointer to `ZydisEncoderRequest` struct. * * @return A zyan status code. */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L4109-L4267
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisEncoderEncodeInstruction
ZYDIS_EXPORT ZyanStatus ZydisEncoderEncodeInstruction(const ZydisEncoderRequest *request, void *buffer, ZyanUSize *length) { if (!request || !buffer || !length) { return ZYAN_STATUS_INVALID_ARGUMENT; } ZYAN_CHECK(ZydisEncoderCheckRequestSanity(request)); ZydisEncoderInstructionMatch mat...
/* ============================================================================================== */ /* Exported functions */ /* ============================================================================================== */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Encoder.c#L4273-L4294
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterBufferInit
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 ...
/* ---------------------------------------------------------------------------------------------- */ /* ============================================================================================== */ /* Internal functions */ /* ==============...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Formatter.c#L58-L78
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterInit
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_SU...
/* ---------------------------------------------------------------------------------------------- */ /* ============================================================================================== */ /* Exported functions */ /* ==============...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Formatter.c#L120-L130
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterSetProperty
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 ZYDI...
/* ---------------------------------------------------------------------------------------------- */ /* Setter */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Formatter.c#L136-L374
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterFormatInstruction
ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter, const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands, ZyanU8 operand_count, char* buffer, ZyanUSize length, ZyanU64 runtime_address) { return ZydisFormatterFormatInstructionEx(formatter, instruction, oper...
/* ---------------------------------------------------------------------------------------------- */ /* Formatting */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Formatter.c#L450-L456
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterTokenizeInstruction
ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* formatter, const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands, ZyanU8 operand_count, void* buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst** token) { return ZydisFormatterTokenizeI...
/* ---------------------------------------------------------------------------------------------- */ /* Tokenizing */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Formatter.c#L559-L566
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterATTFormatInstruction
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(for...
/* ============================================================================================== */ /* Formatter functions */ /* ============================================================================================== */ /* --------------...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterATT.c#L43-L194
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterATTFormatOperandMEM
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...
/* ---------------------------------------------------------------------------------------------- */ /* Operands */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterATT.c#L200-L268
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterATTPrintMnemonic
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 ZydisShortSt...
/* ---------------------------------------------------------------------------------------------- */ /* Elemental tokens */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterATT.c#L274-L344
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterHelperGetExplicitSize
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->m...
/* ============================================================================================== */ /* Helper functions */ /* ============================================================================================== */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterBase.c#L80-L139
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterBaseFormatOperandREG
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.v...
/* ============================================================================================== */ /* Formatter functions */ /* ============================================================================================== */ /* --------------...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterBase.c#L149-L157
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterBasePrintAddressABS
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->op...
/* ---------------------------------------------------------------------------------------------- */ /* Elemental tokens */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterBase.c#L218-L255
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterBasePrintSegment
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) { c...
/* ---------------------------------------------------------------------------------------------- */ /* Optional tokens */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterBase.c#L373-L418
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterTokenGetValue
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(ZydisFormatt...
/* ============================================================================================== */ /* Exported functions */ /* ============================================================================================== */ /* --------------...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterBuffer.c#L38-L50
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterBufferGetToken
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...
/* ---------------------------------------------------------------------------------------------- */ /* Buffer */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterBuffer.c#L73-L88
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterIntelFormatInstruction
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(f...
/* ============================================================================================== */ /* Formatter functions */ /* ============================================================================================== */ /* --------------...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterIntel.c#L45-L194
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisFormatterIntelFormatInstructionMASM
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` ...
/* ---------------------------------------------------------------------------------------------- */ /* MASM */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/FormatterIntel.c#L396-L409
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisRegisterEncode
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 >=...
/* ============================================================================================== */ /* Exported functions */ /* ============================================================================================== */ /* --------------...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Register.c#L97-L118
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisRegisterClassGetWidth
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 ...
/* ---------------------------------------------------------------------------------------------- */ /* Register class */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Register.c#L276-L287
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetInstructionDefinition
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_IN...
/* ---------------------------------------------------------------------------------------------- */ /* ============================================================================================== */ /* Functions */ /* ==============...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/SharedData.c#L74-L104
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisStringAppendDecU
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) ZYAN_CHECK(ZydisStringAppend...
/* ---------------------------------------------------------------------------------------------- */ /* ============================================================================================== */ /* Public Functions */ /* ==============...
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/String.c#L307-L330
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetInstructionSegments
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...
/* ---------------------------------------------------------------------------------------------- */ /* Instruction segments */ /* ---------------------------------------------------------------------------------------------- */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Utils.c#L175-L319
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
ZydisGetVersion
ZyanU64 ZydisGetVersion(void) { return ZYDIS_VERSION; }
/* ============================================================================================== */ /* Exported functions */ /* ============================================================================================== */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/src/Zydis.c#L33-L36
8b81e76efe457b59be3a6e752efd43916ba0cabb
BugChecker
github_2023
vitoplantamura
c
main
int main(int argc, char** argv) { if (ZydisGetVersion() != ZYDIS_VERSION) { ZYAN_FPUTS("Invalid zydis version\n", ZYAN_STDERR); return EXIT_FAILURE; } if (argc < 2 || argc > 3) { ZYAN_FPRINTF(ZYAN_STDERR, "Usage: %s -[real|16|32|64] [input file]\n", (argc > 0 ? a...
/* ============================================================================================== */ /* Entry point */ /* ============================================================================================== */
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisDisasm.c#L46-L163
8b81e76efe457b59be3a6e752efd43916ba0cabb