NAME
AED_x86_instruction_walk —
aed x86 instruction
functions
SYNOPSIS
/* -laed */
#include <aed/x86.h>
void
AED_x86_instruction_walk(void
(*callback)(const AED_x86_instruction_info *, void *),
void *opaque);
DESCRIPTION
The
AED_x86_instruction_walk()
function iterates over all instructions supported by both
aed_x86_decoder(3) and
aed_x86_encoder(3). Intended to be used to obtain information
about instructions that is independent of their encoding. The
callback is invoked for every such instruction and the
opaque argument is passed as is.
The definition of the AED_x86_instruction_info structure is as follows:
typedef struct AED_x86_instruction_info {
AED_x86_mnemonic mnemonic;
uint8_t map;
uint8_t op;
struct {
const AED_x86_explicit_operand o;
uint8_t n;
} operands;
struct {
const AED_x86_implicit_operand o;
uint8_t n;
} implicit_operands;
struct {
const char *field;
size_t offset;
} assembler;
} AED_x86_instruction_info;
- mnemonic
- Numeric representation of the instruction mnemonic, such as
AED_X86_ADD. - map
- Instruction map number.
- op
- Instruction opcode.
- operands
- Operands of the instruction. The o field points to
an array of n AED_x86_explicit_operand structures,
which are defined as follows:
typedef struct AED_x86_explicit_operand { uint32_t type; uint8_t r; uint8_t w; } AED_x86_explicit_operand;- type
- Bitmask of possible operand types:
- AED_X86_OPERAND_ADDR
- AED_X86_OPERAND_CR
- AED_X86_OPERAND_DR
- AED_X86_OPERAND_GPR
- AED_X86_OPERAND_IMM
- AED_X86_OPERAND_MEM
- AED_X86_OPERAND_MMX
- AED_X86_OPERAND_OFFSET
- AED_X86_OPERAND_OPMASK
- AED_X86_OPERAND_SEG
- AED_X86_OPERAND_ST
- AED_X86_OPERAND_TMM
- AED_X86_OPERAND_XMM
- AED_X86_OPERAND_YMM
- AED_X86_OPERAND_ZMM
- r
- Non-zero if the operand is read.
- w
- Non-zero if the operand is written.
- implicit_operands
- Implicit operands of the instruction. The o field
points to an array of n AED_x86_implicit_operand
structures, which are defined as follows:
typedef struct AED_x86_implicit_operand { uint8_t type; uint8_t reg; uint8_t r; uint8_t w; } AED_x86_implicit_operand;- type
- Either
AED_X86_IMPLICIT_OPERAND_GPR,AED_X86_IMPLICIT_OPERAND_IMM,AED_X86_IMPLICIT_OPERAND_XMMorAED_X86_IMPLICIT_OPERAND_FLAGS. - reg
- Register number, only applicable to
AED_X86_IMPLICIT_OPERAND_GPRandAED_X86_IMPLICIT_OPERAND_XMM. - r
- Non-zero if the implicit operand is read.
- w
- Non-zero if the implicit operand is written.
- assembler
- Denotes how the instruction can be encoded using AED_x86_assembler as part of aed_x86_encoder(3). The field field is the name of the corresponding field in AED_x86_assembler and the offset field its offset.
SEE ALSO
aed_x86_decoder(3), aed_x86_encoder(3), aed_x86_serializer(3)
AUTHORS
Anton Lindqvist <anton@basename.se>