Zydis v4.1.1

Loading...
Searching...
No Matches
Decoder.h File Reference

Functions for decoding instructions. More...

`#include <Zycore/Types.h>`
`#include <Zycore/Defines.h>`
`#include <Zydis/DecoderTypes.h>`
`#include <Zydis/Status.h>`

Go to the source code of this file.

## Data Structures
struct | ZydisDecoder_
| Defines the ZydisDecoder struct. More...

## Typedefs
typedef enum ZydisDecoderMode_ | ZydisDecoderMode
| Defines the ZydisDecoderMode enum.
typedef struct ZydisDecoder_ | ZydisDecoder
| Defines the ZydisDecoder struct.

## Enumerations
enum | ZydisDecoderMode_ { ZYDIS_DECODER_MODE_MINIMAL , ZYDIS_DECODER_MODE_AMD_BRANCHES , ZYDIS_DECODER_MODE_KNC , ZYDIS_DECODER_MODE_MPX , ZYDIS_DECODER_MODE_CET , ZYDIS_DECODER_MODE_LZCNT , ZYDIS_DECODER_MODE_TZCNT , ZYDIS_DECODER_MODE_WBNOINVD , ZYDIS_DECODER_MODE_CLDEMOTE , ZYDIS_DECODER_MODE_IPREFETCH , ZYDIS_DECODER_MODE_UD0_COMPAT , ZYDIS_DECODER_MODE_MAX_VALUE = ZYDIS_DECODER_MODE_UD0_COMPAT , ZYDIS_DECODER_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_DECODER_MODE_MAX_VALUE) }
| Defines the ZydisDecoderMode enum. More...

## Functions
ZYDIS_EXPORT ZyanStatus | ZydisDecoderInit (ZydisDecoder *decoder, ZydisMachineMode machine_mode, ZydisStackWidth stack_width)
| Initializes the given ZydisDecoder instance.
ZYDIS_EXPORT ZyanStatus | ZydisDecoderEnableMode (ZydisDecoder *decoder, ZydisDecoderMode mode, ZyanBool enabled)
| Enables or disables the specified decoder-mode.
ZYDIS_EXPORT ZyanStatus | ZydisDecoderDecodeFull (const ZydisDecoder *decoder, const void *buffer, ZyanUSize length, ZydisDecodedInstruction *instruction, ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT])
| Decodes the instruction in the given input buffer and returns all details (e.g.
ZYDIS_EXPORT ZyanStatus | ZydisDecoderDecodeInstruction (const ZydisDecoder *decoder, ZydisDecoderContext *context, const void *buffer, ZyanUSize length, ZydisDecodedInstruction *instruction)
| Decodes the instruction in the given input buffer.
ZYDIS_EXPORT ZyanStatus | ZydisDecoderDecodeOperands (const ZydisDecoder *decoder, const ZydisDecoderContext *context, const ZydisDecodedInstruction *instruction, ZydisDecodedOperand *operands, ZyanU8 operand_count)
| Decodes the instruction operands.

## Detailed Description

Functions for decoding instructions.

## Typedef Documentation

## ◆ ZydisDecoder

typedef struct ZydisDecoder_ ZydisDecoder

Defines the ZydisDecoder struct.

All fields in this struct should be considered as "private". Any changes may lead to unexpected behavior.

## ◆ ZydisDecoderMode

typedef enum ZydisDecoderMode_ ZydisDecoderMode

Defines the ZydisDecoderMode enum.

## Enumeration Type Documentation

## ◆ ZydisDecoderMode_

enum ZydisDecoderMode_

Defines the ZydisDecoderMode enum.

Enumerator
ZYDIS_DECODER_MODE_MINIMAL | Enables minimal instruction decoding without semantic analysis. This mode provides access to the mnemonic, the instruction-length, the effective operand-size, the effective address-width, some attributes (e.g. ZYDIS_ATTRIB_IS_RELATIVE) and all of the information in the raw field of the ZydisDecodedInstruction struct. Operands, most attributes and other specific information (like AVX info) are not accessible in this mode. This mode is NOT enabled by default.
ZYDIS_DECODER_MODE_AMD_BRANCHES | Enables the AMD-branch mode. Intel ignores the operand-size override-prefix (0x66) for all branches with 32-bit immediates and forces the operand-size of the instruction to 64-bit in 64-bit mode. In AMD-branch mode 0x66 is not ignored and changes the operand-size and the size of the immediate to 16-bit. This mode is NOT enabled by default.
ZYDIS_DECODER_MODE_KNC | Enables KNC compatibility-mode. KNC and KNL+ chips are sharing opcodes and encodings for some mask-related instructions. Enable this mode to use the old KNC specifications (different mnemonics, operands, ..). This mode is NOT enabled by default.
ZYDIS_DECODER_MODE_MPX | Enables the MPX mode. The MPX isa-extension reuses (overrides) some of the widenop instruction opcodes. This mode is enabled by default.
ZYDIS_DECODER_MODE_CET | Enables the CET mode. The CET isa-extension reuses (overrides) some of the widenop instruction opcodes. This mode is enabled by default.
ZYDIS_DECODER_MODE_LZCNT | Enables the LZCNT mode. The LZCNT isa-extension reuses (overrides) some of the widenop instruction opcodes. This mode is enabled by default.
ZYDIS_DECODER_MODE_TZCNT | Enables the TZCNT mode. The TZCNT isa-extension reuses (overrides) some of the widenop instruction opcodes. This mode is enabled by default.
ZYDIS_DECODER_MODE_WBNOINVD | Enables the WBNOINVD mode. The WBINVD instruction is interpreted as WBNOINVD on ICL chips, if a F3 prefix is used. This mode is disabled by default.
ZYDIS_DECODER_MODE_CLDEMOTE | Enables the CLDEMOTE mode. The CLDEMOTE isa-extension reuses (overrides) some of the widenop instruction opcodes. This mode is enabled by default.
ZYDIS_DECODER_MODE_IPREFETCH | Enables the IPREFETCH mode. The IPREFETCH isa-extension reuses (overrides) some of the widenop instruction opcodes. This mode is enabled by default.
ZYDIS_DECODER_MODE_UD0_COMPAT | Enables the UD0 compatibility mode. Some processors decode the UD0 instruction without a ModR/M byte. Enable this decoder mode to mimic this behavior. This mode is disabled by default.
ZYDIS_DECODER_MODE_MAX_VALUE | Maximum value of this enum.
ZYDIS_DECODER_MODE_REQUIRED_BITS | The minimum number of bits required to represent all values of this enum.