LLVM API Documentation
#include "X86DisassemblerDecoderCommon.h"
Go to the source code of this file.
Classes | |
struct | InternalInstruction |
Macros | |
#define | INSTRUCTION_SPECIFIER_FIELDS uint16_t operands; |
#define | INSTRUCTION_IDS uint16_t instructionIDs; |
#define | modFromModRM(modRM) (((modRM) & 0xc0) >> 6) |
#define | regFromModRM(modRM) (((modRM) & 0x38) >> 3) |
#define | rmFromModRM(modRM) ((modRM) & 0x7) |
#define | scaleFromSIB(sib) (((sib) & 0xc0) >> 6) |
#define | indexFromSIB(sib) (((sib) & 0x38) >> 3) |
#define | baseFromSIB(sib) ((sib) & 0x7) |
#define | wFromREX(rex) (((rex) & 0x8) >> 3) |
#define | rFromREX(rex) (((rex) & 0x4) >> 2) |
#define | xFromREX(rex) (((rex) & 0x2) >> 1) |
#define | bFromREX(rex) ((rex) & 0x1) |
#define | rFromVEX2of3(vex) (((~(vex)) & 0x80) >> 7) |
#define | xFromVEX2of3(vex) (((~(vex)) & 0x40) >> 6) |
#define | bFromVEX2of3(vex) (((~(vex)) & 0x20) >> 5) |
#define | mmmmmFromVEX2of3(vex) ((vex) & 0x1f) |
#define | wFromVEX3of3(vex) (((vex) & 0x80) >> 7) |
#define | vvvvFromVEX3of3(vex) (((~(vex)) & 0x78) >> 3) |
#define | lFromVEX3of3(vex) (((vex) & 0x4) >> 2) |
#define | ppFromVEX3of3(vex) ((vex) & 0x3) |
#define | rFromVEX2of2(vex) (((~(vex)) & 0x80) >> 7) |
#define | vvvvFromVEX2of2(vex) (((~(vex)) & 0x78) >> 3) |
#define | lFromVEX2of2(vex) (((vex) & 0x4) >> 2) |
#define | ppFromVEX2of2(vex) ((vex) & 0x3) |
#define | rFromXOP2of3(xop) (((~(xop)) & 0x80) >> 7) |
#define | xFromXOP2of3(xop) (((~(xop)) & 0x40) >> 6) |
#define | bFromXOP2of3(xop) (((~(xop)) & 0x20) >> 5) |
#define | mmmmmFromXOP2of3(xop) ((xop) & 0x1f) |
#define | wFromXOP3of3(xop) (((xop) & 0x80) >> 7) |
#define | vvvvFromXOP3of3(vex) (((~(vex)) & 0x78) >> 3) |
#define | lFromXOP3of3(xop) (((xop) & 0x4) >> 2) |
#define | ppFromXOP3of3(xop) ((xop) & 0x3) |
#define | REGS_8BIT |
#define | EA_BASES_16BIT |
#define | REGS_16BIT |
#define | EA_BASES_32BIT |
#define | REGS_32BIT |
#define | EA_BASES_64BIT |
#define | REGS_64BIT |
#define | REGS_MMX |
#define | REGS_XMM |
#define | REGS_YMM |
#define | REGS_ZMM |
#define | REGS_SEGMENT |
#define | REGS_DEBUG |
#define | REGS_CONTROL |
#define | ALL_EA_BASES |
#define | ALL_SIB_BASES |
#define | ALL_REGS |
#define | ENTRY(x) EA_BASE_##x, |
#define | ENTRY(x) EA_REG_##x, |
#define | ENTRY(x) SIB_INDEX_##x, |
#define | ENTRY(x) SIB_BASE_##x, |
#define | ENTRY(x) MODRM_REG_##x, |
Typedefs | |
typedef uint8_t | BOOL |
typedef int(* | byteReader_t )(const void *arg, uint8_t *byte, uint64_t address) |
typedef void(* | dlog_t )(void *arg, const char *log) |
Enumerations | |
enum | EABase { EA_BASE_NONE, EA_max } |
enum | SIBIndex { SIB_INDEX_NONE, SIB_INDEX_max } |
enum | SIBBase { SIB_BASE_NONE, SIB_BASE_max } |
enum | EADisplacement { EA_DISP_NONE, EA_DISP_8, EA_DISP_16, EA_DISP_32 } |
enum | Reg { MODRM_REG_max } |
enum | SegmentOverride { SEG_OVERRIDE_NONE, SEG_OVERRIDE_CS, SEG_OVERRIDE_SS, SEG_OVERRIDE_DS, SEG_OVERRIDE_ES, SEG_OVERRIDE_FS, SEG_OVERRIDE_GS, SEG_OVERRIDE_max } |
enum | VEXLeadingOpcodeByte { VEX_LOB_0F = 0x1, VEX_LOB_0F38 = 0x2, VEX_LOB_0F3A = 0x3 } |
enum | XOPMapSelect { XOP_MAP_SELECT_8 = 0x8, XOP_MAP_SELECT_9 = 0x9, XOP_MAP_SELECT_A = 0xA } |
enum | VEXPrefixCode { VEX_PREFIX_NONE = 0x0, VEX_PREFIX_66 = 0x1, VEX_PREFIX_F3 = 0x2, VEX_PREFIX_F2 = 0x3 } |
enum | VEXXOPType { TYPE_NO_VEX_XOP = 0x0, TYPE_VEX_2B = 0x1, TYPE_VEX_3B = 0x2, TYPE_XOP = 0x3 } |
Functions | |
int | decodeInstruction (struct InternalInstruction *insn, byteReader_t reader, const void *readerArg, dlog_t logger, void *loggerArg, const void *miiArg, uint64_t startLoc, DisassemblerMode mode) |
void | x86DisassemblerDebug (const char *file, unsigned line, const char *s) |
const char * | x86DisassemblerGetInstrName (unsigned Opcode, const void *mii) |
#define ALL_EA_BASES |
Definition at line 346 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory(), and translateRMRegister().
#define ALL_REGS |
Definition at line 355 of file X86DisassemblerDecoder.h.
Referenced by translateRegister(), translateRMMemory(), and translateRMRegister().
#define ALL_SIB_BASES |
Definition at line 351 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
#define baseFromSIB | ( | sib | ) | ((sib) & 0x7) |
Definition at line 42 of file X86DisassemblerDecoder.h.
Referenced by readSIB().
#define bFromREX | ( | rex | ) | ((rex) & 0x1) |
Definition at line 46 of file X86DisassemblerDecoder.h.
Referenced by readModRM(), readOpcodeRegister(), and readSIB().
#define bFromVEX2of3 | ( | vex | ) | (((~(vex)) & 0x20) >> 5) |
Definition at line 50 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define bFromXOP2of3 | ( | xop | ) | (((~(xop)) & 0x20) >> 5) |
Definition at line 64 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define EA_BASES_16BIT |
Definition at line 97 of file X86DisassemblerDecoder.h.
#define EA_BASES_32BIT |
Definition at line 133 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
#define EA_BASES_64BIT |
Definition at line 169 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
#define ENTRY | ( | x | ) | EA_BASE_##x, |
Definition at line 429 of file X86DisassemblerDecoder.h.
#define ENTRY | ( | x | ) | EA_REG_##x, |
Definition at line 429 of file X86DisassemblerDecoder.h.
#define ENTRY | ( | x | ) | SIB_INDEX_##x, |
Definition at line 429 of file X86DisassemblerDecoder.h.
#define ENTRY | ( | x | ) | SIB_BASE_##x, |
Definition at line 429 of file X86DisassemblerDecoder.h.
#define ENTRY | ( | x | ) | MODRM_REG_##x, |
Definition at line 429 of file X86DisassemblerDecoder.h.
#define indexFromSIB | ( | sib | ) | (((sib) & 0x38) >> 3) |
Definition at line 41 of file X86DisassemblerDecoder.h.
Referenced by readSIB().
#define INSTRUCTION_IDS uint16_t instructionIDs; |
Definition at line 26 of file X86DisassemblerDecoder.h.
#define INSTRUCTION_SPECIFIER_FIELDS uint16_t operands; |
Definition at line 23 of file X86DisassemblerDecoder.h.
#define lFromVEX2of2 | ( | vex | ) | (((vex) & 0x4) >> 2) |
Definition at line 59 of file X86DisassemblerDecoder.h.
Referenced by getID().
#define lFromVEX3of3 | ( | vex | ) | (((vex) & 0x4) >> 2) |
Definition at line 54 of file X86DisassemblerDecoder.h.
Referenced by getID().
#define lFromXOP3of3 | ( | xop | ) | (((xop) & 0x4) >> 2) |
Definition at line 68 of file X86DisassemblerDecoder.h.
Referenced by getID().
#define mmmmmFromVEX2of3 | ( | vex | ) | ((vex) & 0x1f) |
Definition at line 51 of file X86DisassemblerDecoder.h.
Referenced by readOpcode().
#define mmmmmFromXOP2of3 | ( | xop | ) | ((xop) & 0x1f) |
Definition at line 65 of file X86DisassemblerDecoder.h.
Referenced by readOpcode().
#define modFromModRM | ( | modRM | ) | (((modRM) & 0xc0) >> 6) |
Definition at line 37 of file X86DisassemblerDecoder.h.
Referenced by decode(), readModRM(), and readSIB().
#define ppFromVEX2of2 | ( | vex | ) | ((vex) & 0x3) |
Definition at line 60 of file X86DisassemblerDecoder.h.
Referenced by getID(), and readPrefixes().
#define ppFromVEX3of3 | ( | vex | ) | ((vex) & 0x3) |
Definition at line 55 of file X86DisassemblerDecoder.h.
Referenced by getID(), and readPrefixes().
#define ppFromXOP3of3 | ( | xop | ) | ((xop) & 0x3) |
Definition at line 69 of file X86DisassemblerDecoder.h.
Referenced by getID(), and readPrefixes().
#define regFromModRM | ( | modRM | ) | (((modRM) & 0x38) >> 3) |
Definition at line 38 of file X86DisassemblerDecoder.h.
Referenced by readModRM().
#define REGS_16BIT |
Definition at line 115 of file X86DisassemblerDecoder.h.
#define REGS_32BIT |
Definition at line 151 of file X86DisassemblerDecoder.h.
#define REGS_64BIT |
Definition at line 187 of file X86DisassemblerDecoder.h.
#define REGS_8BIT |
Definition at line 75 of file X86DisassemblerDecoder.h.
#define REGS_CONTROL |
#define REGS_DEBUG |
#define REGS_MMX |
#define REGS_SEGMENT |
Definition at line 317 of file X86DisassemblerDecoder.h.
#define REGS_XMM |
Definition at line 215 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
#define REGS_YMM |
Definition at line 249 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
#define REGS_ZMM |
Definition at line 283 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
#define rFromREX | ( | rex | ) | (((rex) & 0x4) >> 2) |
Definition at line 44 of file X86DisassemblerDecoder.h.
Referenced by readModRM().
#define rFromVEX2of2 | ( | vex | ) | (((~(vex)) & 0x80) >> 7) |
Definition at line 57 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define rFromVEX2of3 | ( | vex | ) | (((~(vex)) & 0x80) >> 7) |
Definition at line 48 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define rFromXOP2of3 | ( | xop | ) | (((~(xop)) & 0x80) >> 7) |
Definition at line 62 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define rmFromModRM | ( | modRM | ) | ((modRM) & 0x7) |
Definition at line 39 of file X86DisassemblerDecoder.h.
Referenced by readModRM().
#define scaleFromSIB | ( | sib | ) | (((sib) & 0xc0) >> 6) |
Definition at line 40 of file X86DisassemblerDecoder.h.
Referenced by readSIB().
#define vvvvFromVEX2of2 | ( | vex | ) | (((~(vex)) & 0x78) >> 3) |
Definition at line 58 of file X86DisassemblerDecoder.h.
Referenced by readVVVV().
#define vvvvFromVEX3of3 | ( | vex | ) | (((~(vex)) & 0x78) >> 3) |
Definition at line 53 of file X86DisassemblerDecoder.h.
Referenced by readVVVV().
#define vvvvFromXOP3of3 | ( | vex | ) | (((~(vex)) & 0x78) >> 3) |
Definition at line 67 of file X86DisassemblerDecoder.h.
Referenced by readVVVV().
#define wFromREX | ( | rex | ) | (((rex) & 0x8) >> 3) |
Definition at line 43 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define wFromVEX3of3 | ( | vex | ) | (((vex) & 0x80) >> 7) |
Definition at line 52 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define wFromXOP3of3 | ( | xop | ) | (((xop) & 0x80) >> 7) |
Definition at line 66 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define xFromREX | ( | rex | ) | (((rex) & 0x2) >> 1) |
Definition at line 45 of file X86DisassemblerDecoder.h.
Referenced by readSIB().
#define xFromVEX2of3 | ( | vex | ) | (((~(vex)) & 0x40) >> 6) |
Definition at line 49 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
#define xFromXOP2of3 | ( | xop | ) | (((~(xop)) & 0x40) >> 6) |
Definition at line 63 of file X86DisassemblerDecoder.h.
Referenced by readPrefixes().
typedef uint8_t BOOL |
Definition at line 483 of file X86DisassemblerDecoder.h.
typedef int(* byteReader_t)(const void *arg, uint8_t *byte, uint64_t address) |
Definition at line 496 of file X86DisassemblerDecoder.h.
typedef void(* dlog_t)(void *arg, const char *log) |
Definition at line 506 of file X86DisassemblerDecoder.h.
enum EABase |
Enumerator | |
---|---|
EA_BASE_NONE | |
EA_max |
Definition at line 375 of file X86DisassemblerDecoder.h.
enum EADisplacement |
Enumerator | |
---|---|
EA_DISP_NONE | |
EA_DISP_8 | |
EA_DISP_16 | |
EA_DISP_32 |
Definition at line 418 of file X86DisassemblerDecoder.h.
enum Reg |
Enumerator | |
---|---|
MODRM_REG_max |
Definition at line 428 of file X86DisassemblerDecoder.h.
enum SegmentOverride |
Enumerator | |
---|---|
SEG_OVERRIDE_NONE | |
SEG_OVERRIDE_CS | |
SEG_OVERRIDE_SS | |
SEG_OVERRIDE_DS | |
SEG_OVERRIDE_ES | |
SEG_OVERRIDE_FS | |
SEG_OVERRIDE_GS | |
SEG_OVERRIDE_max |
Definition at line 438 of file X86DisassemblerDecoder.h.
enum SIBBase |
Enumerator | |
---|---|
SIB_BASE_NONE | |
SIB_BASE_max |
Definition at line 406 of file X86DisassemblerDecoder.h.
enum SIBIndex |
Enumerator | |
---|---|
SIB_INDEX_NONE | |
SIB_INDEX_max |
Definition at line 392 of file X86DisassemblerDecoder.h.
enum VEXLeadingOpcodeByte |
Enumerator | |
---|---|
VEX_LOB_0F | |
VEX_LOB_0F38 | |
VEX_LOB_0F3A |
Definition at line 453 of file X86DisassemblerDecoder.h.
enum VEXPrefixCode |
Enumerator | |
---|---|
VEX_PREFIX_NONE | |
VEX_PREFIX_66 | |
VEX_PREFIX_F3 | |
VEX_PREFIX_F2 |
Definition at line 469 of file X86DisassemblerDecoder.h.
enum VEXXOPType |
Enumerator | |
---|---|
TYPE_NO_VEX_XOP | |
TYPE_VEX_2B | |
TYPE_VEX_3B | |
TYPE_XOP |
Definition at line 476 of file X86DisassemblerDecoder.h.
enum XOPMapSelect |
Enumerator | |
---|---|
XOP_MAP_SELECT_8 | |
XOP_MAP_SELECT_9 | |
XOP_MAP_SELECT_A |
Definition at line 459 of file X86DisassemblerDecoder.h.
int decodeInstruction | ( | struct InternalInstruction * | insn, |
byteReader_t | reader, | ||
const void * | readerArg, | ||
dlog_t | logger, | ||
void * | loggerArg, | ||
const void * | miiArg, | ||
uint64_t | startLoc, | ||
DisassemblerMode | mode | ||
) |
Definition at line 1712 of file X86DisassemblerDecoder.c.
References dbgprintf(), InternalInstruction::dlog, InternalInstruction::dlogArg, getID(), InternalInstruction::instructionID, InternalInstruction::length, logger(), llvm::Intrinsic::memset, InternalInstruction::mode, InternalInstruction::numImmediatesConsumed, InternalInstruction::operands, InternalInstruction::reader, InternalInstruction::readerArg, InternalInstruction::readerCursor, readOpcode(), readOperands(), readPrefixes(), InternalInstruction::spec, and InternalInstruction::startLocation.
Referenced by llvm::X86Disassembler::X86GenericDisassembler::getInstruction().
void x86DisassemblerDebug | ( | const char * | file, |
unsigned | line, | ||
const char * | s | ||
) |
Definition at line 38 of file X86Disassembler.cpp.
References llvm::dbgs().
const char* x86DisassemblerGetInstrName | ( | unsigned | Opcode, |
const void * | mii | ||
) |
Definition at line 44 of file X86Disassembler.cpp.
References llvm::MCInstrInfo::getName(), and MII.
Referenced by getID().