The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
x86.h File Reference

x86 disassembler header More...

#include <stdbool.h>
#include "instruction.h"
+ Include dependency graph for x86.h:

Go to the source code of this file.

Data Structures

struct  disassembly_state
 
struct  _insn
 

Macros

#define A32(f)   ((f) & ADDR_32)
 
#define D32(f)   ((f) & DATA_32)
 
#define A64(f)   ((f) & ADDR_64)
 
#define D64(f)   ((f) & DATA_64)
 
#define p_is_group1(p)
 
#define p_is_group2(p)
 
#define p_is_group3(p)   ((p) == 0x66) /* opsize override */
 
#define p_is_group4(p)   ((p) == 0x67) /* addr size override */
 
#define is_prefix(o)
 
#define is_sse_prefix(o)   (((o) == 0xf2) || ((o) == 0xf3) || ((o) == 0x66))
 
#define is_rex_prefix(r, mode64)   (((r) >= 0x40 && (r) <= 0x4f ) && (mode64))
 
#define REXW(r)   (((r) & 0x08) >> 3)
 
#define REXR(r)   (((r) & 0x04) >> 2)
 
#define REXX(r)   (((r) & 0x02) >> 1)
 
#define REXB(r)   (((r) & 0x01))
 
#define is_jcc_insn(o)   (((o) == 0xe3) || (((o) >= 0x70) && ((o) <= 0x7f)))
 
#define is_esc_jcc_insn(o)   (((o) >= 0x80) && ((o) <= 0x8f))
 
#define has_modrm(addr)
 
#define has_sib(modrm, addr)
 
#define disp_size(modrm, addr)
 

Typedefs

typedef struct _insn insn
 
typedef struct _insninsn_table
 

Enumerations

enum  addr_method {
  ADDR_0, ADDR_A, ADDR_C, ADDR_D,
  ADDR_E, ADDR_F, ADDR_G, ADDR_I,
  ADDR_J, ADDR_M, ADDR_N, ADDR_O,
  ADDR_P, ADDR_Q, ADDR_R, ADDR_S,
  ADDR_T, ADDR_U, ADDR_V, ADDR_W,
  ADDR_X, ADDR_Y, R_START, R_AL,
  R_AH, R_AX, R_EAX, R_RAX,
  R_BL, R_BH, R_BX, R_EBX,
  R_RBX, R_CL, R_CH, R_CX,
  R_ECX, R_RCX, R_DL, R_DH,
  R_DX, R_EDX, R_RDX, R_SIL,
  R_SI, R_ESI, R_RSI, R_DIL,
  R_DI, R_EDI, R_RDI, R_BP,
  R_EBP, R_SPL, R_SP, R_ESP,
  R_RSP, R_CS, R_DS, R_SS,
  R_ES, R_FS, R_GS, R_F,
  R_EF, R_IP, R_EIP, R_RIP,
  R_ST0, R_ST1, R_ST2, R_ST3,
  R_ST4, R_ST5, R_ST6, R_ST7,
  R_R8L, R_R8W, R_R8D, R_R8,
  R_R9L, R_R9W, R_R9D, R_R9,
  R_R10L, R_R10W, R_R10D, R_R10,
  R_R11L, R_R11W, R_R11D, R_R11,
  R_R12L, R_R12W, R_R12D, R_R12,
  R_R13L, R_R13W, R_R13D, R_R13,
  R_R14L, R_R14W, R_R14D, R_R14,
  R_R15L, R_R15W, R_R15D, R_R15,
  R_MM0, R_MM1, R_MM2, R_MM3,
  R_MM4, R_MM5, R_MM6, R_MM7,
  R_XMM0, R_XMM1, R_XMM2, R_XMM3,
  R_XMM4, R_XMM5, R_XMM6, R_XMM7,
  R_XMM8, R_XMM9, R_XMM10, R_XMM11,
  R_XMM12, R_XMM13, R_XMM14, R_XMM15,
  R_END, IMMED_1, ADDR_0, ADDR_A,
  ADDR_C, ADDR_D, ADDR_E, ADDR_F,
  ADDR_G, ADDR_I, ADDR_J, ADDR_M,
  ADDR_N, ADDR_O, ADDR_P, ADDR_Q,
  ADDR_R, ADDR_S, ADDR_T, ADDR_U,
  ADDR_V, ADDR_W, ADDR_X, ADDR_Y,
  R_START, R_AL, R_AH, R_AX,
  R_EAX, R_RAX, R_BL, R_BH,
  R_BX, R_EBX, R_RBX, R_CL,
  R_CH, R_CX, R_ECX, R_RCX,
  R_DL, R_DH, R_DX, R_EDX,
  R_RDX, R_SIL, R_SI, R_ESI,
  R_RSI, R_DIL, R_DI, R_EDI,
  R_RDI, R_BP, R_EBP, R_SPL,
  R_SP, R_ESP, R_RSP, R_CS,
  R_DS, R_SS, R_ES, R_FS,
  R_GS, R_F, R_EF, R_IP,
  R_EIP, R_RIP, R_ST0, R_ST1,
  R_ST2, R_ST3, R_ST4, R_ST5,
  R_ST6, R_ST7, R_R8L, R_R8W,
  R_R8D, R_R8, R_R9L, R_R9W,
  R_R9D, R_R9, R_R10L, R_R10W,
  R_R10D, R_R10, R_R11L, R_R11W,
  R_R11D, R_R11, R_R12L, R_R12W,
  R_R12D, R_R12, R_R13L, R_R13W,
  R_R13D, R_R13, R_R14L, R_R14W,
  R_R14D, R_R14, R_R15L, R_R15W,
  R_R15D, R_R15, R_MM0, R_MM1,
  R_MM2, R_MM3, R_MM4, R_MM5,
  R_MM6, R_MM7, R_XMM0, R_XMM1,
  R_XMM2, R_XMM3, R_XMM4, R_XMM5,
  R_XMM6, R_XMM7, R_XMM8, R_XMM9,
  R_XMM10, R_XMM11, R_XMM12, R_XMM13,
  R_XMM14, R_XMM15, R_END, IMMED_1
}
 
enum  operand_type {
  OP_0, OP_A, OP_B, OP_C,
  OP_D, OP_DQ, OP_P, OP_PI,
  OP_PS, OP_Q, OP_S, OP_SS,
  OP_SI, OP_V, OP_W, OP_PD,
  OP_SD, OP_E, OP_Y, OP_FS,
  OP_FSR, OP_M80, OP_M512byte, OP_0,
  OP_A, OP_B, OP_C, OP_D,
  OP_DQ, OP_P, OP_PI, OP_PS,
  OP_Q, OP_S, OP_SS, OP_SI,
  OP_V, OP_W, OP_PD, OP_SD,
  OP_E, OP_Y, OP_FS, OP_FSR,
  OP_M80, OP_M512byte
}
 
enum  op_size {
  SIZE_8, SIZE_16, SIZE_32, SIZE_64,
  SIZE_8, SIZE_16, SIZE_32, SIZE_64
}
 
enum  reg_size {
  REG_SIZE_8, REG_SIZE_16, REG_SIZE_32, REG_SIZE_64,
  REG_SIZE_128, REG_SIZE_8, REG_SIZE_16, REG_SIZE_32,
  REG_SIZE_64, REG_SIZE_128
}
 

Functions

void x86_disassemble_instruction (unsigned char *text, unsigned long *pos, insn_info_x86 *instrument, char flags)
 

Detailed Description

x86 disassembler header

x86 disassembler header

This file is part of ROOT-Sim (ROme OpTimistic Simulator).

ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.

ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Author
Alessandro Pellegrini
Date
Jan 25, 2012

Definition in file x86.h.

Macro Definition Documentation

#define disp_size (   modrm,
  addr 
)
Value:
((((modrm) & 0xC0) == 0x40) ? 1 \
: ((((addr) == SIZE_16) \
&& ((((modrm) & 0xC7) == 0x06) \
|| (((modrm) & 0xC0) == 0x80))) ? 2 \
: (((((addr) == SIZE_32) || (addr) == SIZE_64) \
&& ((((modrm) & 0xC7) == 0x05) \
|| (((modrm) & 0xC0) == 0x80))) ? 4\
: 0)))

Definition at line 107 of file x86.h.

#define has_modrm (   addr)
Value:
(((addr) == ADDR_C) \
|| ((addr) == ADDR_D) \
|| ((addr) == ADDR_E) \
|| ((addr) == ADDR_G) \
|| ((addr) == ADDR_M) \
|| ((addr) == ADDR_P) \
|| ((addr) == ADDR_Q) \
|| ((addr) == ADDR_R) \
|| ((addr) == ADDR_S) \
|| ((addr) == ADDR_T) \
|| ((addr) == ADDR_V) \
|| ((addr) == ADDR_W))

Definition at line 81 of file x86.h.

#define has_sib (   modrm,
  addr 
)
Value:
((((modrm) & 0x07) == 0x04) \
&& (((addr) == SIZE_32) || (addr) == SIZE_64) \
&& (((modrm) & 0xC0) != 0xC0))

Definition at line 96 of file x86.h.

#define is_prefix (   o)
Value:
(p_is_group1 (o) || p_is_group2 (o) \
|| p_is_group3 (o) || p_is_group4 (o))

Definition at line 58 of file x86.h.

#define p_is_group1 (   p)
Value:
(((p) == 0xf0) /* lock */ \
|| ((p) == 0xf2) /* repne/repnz */ \
|| ((p) == 0xf3)) /* rep/repe/repz */

Definition at line 43 of file x86.h.

#define p_is_group2 (   p)
Value:
(((p) == 0x2e) /* CS override/branch not taken */ \
|| ((p) == 0x36) /* SS override */ \
|| ((p) == 0x3e) /* DS override/branch taken */ \
|| ((p) == 0x26) /* ES override */ \
|| ((p) == 0x64) /* FS override */ \
|| ((p) == 0x65)) /* GS override */

Definition at line 47 of file x86.h.