LLVM API Documentation
#include "X86DisassemblerDecoderCommon.h"

Go to the source code of this file.
Classes | |
| struct | InternalInstruction |
Defines | |
| #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 | 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_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 } |
| enum | SIBIndex { SIB_INDEX_NONE } |
| enum | SIBBase { SIB_BASE_NONE } |
| enum | EADisplacement { EA_DISP_NONE, EA_DISP_8, EA_DISP_16, EA_DISP_32 } |
| enum | Reg |
| 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 | VEXPrefixCode { VEX_PREFIX_NONE = 0x0, VEX_PREFIX_66 = 0x1, VEX_PREFIX_F3 = 0x2, VEX_PREFIX_F2 = 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 |
EA_BASES_16BIT \ EA_BASES_32BIT \ EA_BASES_64BIT
Definition at line 271 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory(), and translateRMRegister().
| #define ALL_REGS |
REGS_8BIT \ REGS_16BIT \ REGS_32BIT \ REGS_64BIT \ REGS_MMX \ REGS_XMM \ REGS_YMM \ REGS_SEGMENT \ REGS_DEBUG \ REGS_CONTROL \ ENTRY(RIP)
Definition at line 280 of file X86DisassemblerDecoder.h.
Referenced by translateRegister(), translateRMMemory(), and translateRMRegister().
| #define ALL_SIB_BASES |
REGS_32BIT \ REGS_64BIT
Definition at line 276 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 EA_BASES_16BIT |
| #define EA_BASES_32BIT |
ENTRY(EAX) \ ENTRY(ECX) \ ENTRY(EDX) \ ENTRY(EBX) \ ENTRY(sib) \ ENTRY(EBP) \ ENTRY(ESI) \ ENTRY(EDI) \ ENTRY(R8D) \ ENTRY(R9D) \ ENTRY(R10D) \ ENTRY(R11D) \ ENTRY(R12D) \ ENTRY(R13D) \ ENTRY(R14D) \ ENTRY(R15D)
Definition at line 124 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
| #define EA_BASES_64BIT |
ENTRY(RAX) \ ENTRY(RCX) \ ENTRY(RDX) \ ENTRY(RBX) \ ENTRY(sib64) \ ENTRY(RBP) \ ENTRY(RSI) \ ENTRY(RDI) \ ENTRY(R8) \ ENTRY(R9) \ ENTRY(R10) \ ENTRY(R11) \ ENTRY(R12) \ ENTRY(R13) \ ENTRY(R14) \ ENTRY(R15)
Definition at line 160 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
| #define ENTRY | ( | x | ) | EA_BASE_##x, |
Definition at line 352 of file X86DisassemblerDecoder.h.
| #define ENTRY | ( | x | ) | EA_REG_##x, |
Definition at line 352 of file X86DisassemblerDecoder.h.
| #define ENTRY | ( | x | ) | SIB_INDEX_##x, |
Definition at line 352 of file X86DisassemblerDecoder.h.
| #define ENTRY | ( | x | ) | SIB_BASE_##x, |
Definition at line 352 of file X86DisassemblerDecoder.h.
| #define ENTRY | ( | x | ) | MODRM_REG_##x, |
Definition at line 352 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 mmmmmFromVEX2of3 | ( | vex | ) | ((vex) & 0x1f) |
Definition at line 51 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 regFromModRM | ( | modRM | ) | (((modRM) & 0x38) >> 3) |
Definition at line 38 of file X86DisassemblerDecoder.h.
Referenced by readModRM().
| #define REGS_16BIT |
ENTRY(AX) \ ENTRY(CX) \ ENTRY(DX) \ ENTRY(BX) \ ENTRY(SP) \ ENTRY(BP) \ ENTRY(SI) \ ENTRY(DI) \ ENTRY(R8W) \ ENTRY(R9W) \ ENTRY(R10W) \ ENTRY(R11W) \ ENTRY(R12W) \ ENTRY(R13W) \ ENTRY(R14W) \ ENTRY(R15W)
Definition at line 106 of file X86DisassemblerDecoder.h.
| #define REGS_32BIT |
| #define REGS_64BIT |
ENTRY(RAX) \ ENTRY(RCX) \ ENTRY(RDX) \ ENTRY(RBX) \ ENTRY(RSP) \ ENTRY(RBP) \ ENTRY(RSI) \ ENTRY(RDI) \ ENTRY(R8) \ ENTRY(R9) \ ENTRY(R10) \ ENTRY(R11) \ ENTRY(R12) \ ENTRY(R13) \ ENTRY(R14) \ ENTRY(R15)
Definition at line 178 of file X86DisassemblerDecoder.h.
| #define REGS_8BIT |
ENTRY(AL) \ ENTRY(CL) \ ENTRY(DL) \ ENTRY(BL) \ ENTRY(AH) \ ENTRY(CH) \ ENTRY(DH) \ ENTRY(BH) \ ENTRY(R8B) \ ENTRY(R9B) \ ENTRY(R10B) \ ENTRY(R11B) \ ENTRY(R12B) \ ENTRY(R13B) \ ENTRY(R14B) \ ENTRY(R15B) \ ENTRY(SPL) \ ENTRY(BPL) \ ENTRY(SIL) \ ENTRY(DIL)
Definition at line 66 of file X86DisassemblerDecoder.h.
| #define REGS_CONTROL |
ENTRY(CR0) \ ENTRY(CR1) \ ENTRY(CR2) \ ENTRY(CR3) \ ENTRY(CR4) \ ENTRY(CR5) \ ENTRY(CR6) \ ENTRY(CR7) \ ENTRY(CR8)
Definition at line 260 of file X86DisassemblerDecoder.h.
| #define REGS_DEBUG |
ENTRY(DR0) \ ENTRY(DR1) \ ENTRY(DR2) \ ENTRY(DR3) \ ENTRY(DR4) \ ENTRY(DR5) \ ENTRY(DR6) \ ENTRY(DR7)
Definition at line 250 of file X86DisassemblerDecoder.h.
| #define REGS_MMX |
ENTRY(MM0) \ ENTRY(MM1) \ ENTRY(MM2) \ ENTRY(MM3) \ ENTRY(MM4) \ ENTRY(MM5) \ ENTRY(MM6) \ ENTRY(MM7)
Definition at line 196 of file X86DisassemblerDecoder.h.
| #define REGS_SEGMENT |
Definition at line 242 of file X86DisassemblerDecoder.h.
| #define REGS_XMM |
ENTRY(XMM0) \ ENTRY(XMM1) \ ENTRY(XMM2) \ ENTRY(XMM3) \ ENTRY(XMM4) \ ENTRY(XMM5) \ ENTRY(XMM6) \ ENTRY(XMM7) \ ENTRY(XMM8) \ ENTRY(XMM9) \ ENTRY(XMM10) \ ENTRY(XMM11) \ ENTRY(XMM12) \ ENTRY(XMM13) \ ENTRY(XMM14) \ ENTRY(XMM15)
Definition at line 206 of file X86DisassemblerDecoder.h.
Referenced by translateRMMemory().
| #define REGS_YMM |
ENTRY(YMM0) \ ENTRY(YMM1) \ ENTRY(YMM2) \ ENTRY(YMM3) \ ENTRY(YMM4) \ ENTRY(YMM5) \ ENTRY(YMM6) \ ENTRY(YMM7) \ ENTRY(YMM8) \ ENTRY(YMM9) \ ENTRY(YMM10) \ ENTRY(YMM11) \ ENTRY(YMM12) \ ENTRY(YMM13) \ ENTRY(YMM14) \ ENTRY(YMM15)
Definition at line 224 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 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 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 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().
| typedef uint8_t BOOL |
Definition at line 393 of file X86DisassemblerDecoder.h.
| typedef int(* byteReader_t)(const void *arg, uint8_t *byte, uint64_t address) |
Definition at line 406 of file X86DisassemblerDecoder.h.
| typedef void(* dlog_t)(void *arg, const char *log) |
Definition at line 416 of file X86DisassemblerDecoder.h.
| enum EABase |
Definition at line 299 of file X86DisassemblerDecoder.h.
| enum EADisplacement |
Definition at line 341 of file X86DisassemblerDecoder.h.
| enum Reg |
Definition at line 351 of file X86DisassemblerDecoder.h.
| 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 |
Definition at line 361 of file X86DisassemblerDecoder.h.
| enum SIBBase |
Definition at line 329 of file X86DisassemblerDecoder.h.
| enum SIBIndex |
Definition at line 316 of file X86DisassemblerDecoder.h.
| enum VEXLeadingOpcodeByte |
Definition at line 376 of file X86DisassemblerDecoder.h.
| enum VEXPrefixCode |
Definition at line 386 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 1639 of file X86DisassemblerDecoder.c.
References dbgprintf(), InternalInstruction::dlog, InternalInstruction::dlogArg, getID(), InternalInstruction::instructionID, InternalInstruction::length, logger(), llvm::LibFunc::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().
Referenced by getID().