Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
emulate.c File Reference
#include <linux/kvm_host.h>
#include "kvm_cache_regs.h"
#include <linux/module.h>
#include <asm/kvm_emulate.h>
#include "x86.h"
#include "tss.h"

Go to the source code of this file.

Data Structures

struct  opcode
 
struct  group_dual
 
struct  gprefix
 

Macros

#define OpNone   0ull
 
#define OpImplicit   1ull /* No generic decode */
 
#define OpReg   2ull /* Register */
 
#define OpMem   3ull /* Memory */
 
#define OpAcc   4ull /* Accumulator: AL/AX/EAX/RAX */
 
#define OpDI   5ull /* ES:DI/EDI/RDI */
 
#define OpMem64   6ull /* Memory, 64-bit */
 
#define OpImmUByte   7ull /* Zero-extended 8-bit immediate */
 
#define OpDX   8ull /* DX register */
 
#define OpCL   9ull /* CL register (for shifts) */
 
#define OpImmByte   10ull /* 8-bit sign extended immediate */
 
#define OpOne   11ull /* Implied 1 */
 
#define OpImm   12ull /* Sign extended immediate */
 
#define OpMem16   13ull /* Memory operand (16-bit). */
 
#define OpMem32   14ull /* Memory operand (32-bit). */
 
#define OpImmU   15ull /* Immediate operand, zero extended */
 
#define OpSI   16ull /* SI/ESI/RSI */
 
#define OpImmFAddr   17ull /* Immediate far address */
 
#define OpMemFAddr   18ull /* Far address in memory */
 
#define OpImmU16   19ull /* Immediate operand, 16 bits, zero extended */
 
#define OpES   20ull /* ES */
 
#define OpCS   21ull /* CS */
 
#define OpSS   22ull /* SS */
 
#define OpDS   23ull /* DS */
 
#define OpFS   24ull /* FS */
 
#define OpGS   25ull /* GS */
 
#define OpMem8   26ull /* 8-bit zero extended memory operand */
 
#define OpBits   5 /* Width of operand field */
 
#define OpMask   ((1ull << OpBits) - 1)
 
#define ByteOp   (1<<0) /* 8-bit operands. */
 
#define DstShift   1
 
#define ImplicitOps   (OpImplicit << DstShift)
 
#define DstReg   (OpReg << DstShift)
 
#define DstMem   (OpMem << DstShift)
 
#define DstAcc   (OpAcc << DstShift)
 
#define DstDI   (OpDI << DstShift)
 
#define DstMem64   (OpMem64 << DstShift)
 
#define DstImmUByte   (OpImmUByte << DstShift)
 
#define DstDX   (OpDX << DstShift)
 
#define DstMask   (OpMask << DstShift)
 
#define SrcShift   6
 
#define SrcNone   (OpNone << SrcShift)
 
#define SrcReg   (OpReg << SrcShift)
 
#define SrcMem   (OpMem << SrcShift)
 
#define SrcMem16   (OpMem16 << SrcShift)
 
#define SrcMem32   (OpMem32 << SrcShift)
 
#define SrcImm   (OpImm << SrcShift)
 
#define SrcImmByte   (OpImmByte << SrcShift)
 
#define SrcOne   (OpOne << SrcShift)
 
#define SrcImmUByte   (OpImmUByte << SrcShift)
 
#define SrcImmU   (OpImmU << SrcShift)
 
#define SrcSI   (OpSI << SrcShift)
 
#define SrcImmFAddr   (OpImmFAddr << SrcShift)
 
#define SrcMemFAddr   (OpMemFAddr << SrcShift)
 
#define SrcAcc   (OpAcc << SrcShift)
 
#define SrcImmU16   (OpImmU16 << SrcShift)
 
#define SrcDX   (OpDX << SrcShift)
 
#define SrcMem8   (OpMem8 << SrcShift)
 
#define SrcMask   (OpMask << SrcShift)
 
#define BitOp   (1<<11)
 
#define MemAbs   (1<<12) /* Memory operand is absolute displacement */
 
#define String   (1<<13) /* String instruction (rep capable) */
 
#define Stack   (1<<14) /* Stack instruction (push/pop) */
 
#define GroupMask   (7<<15) /* Opcode uses one of the group mechanisms */
 
#define Group   (1<<15) /* Bits 3:5 of modrm byte extend opcode */
 
#define GroupDual   (2<<15) /* Alternate decoding of mod == 3 */
 
#define Prefix   (3<<15) /* Instruction varies with 66/f2/f3 prefix */
 
#define RMExt   (4<<15) /* Opcode extension in ModRM r/m if mod == 3 */
 
#define Sse   (1<<18) /* SSE Vector instruction */
 
#define ModRM   (1<<19)
 
#define Mov   (1<<20)
 
#define Prot   (1<<21) /* instruction generates #UD if not in prot-mode */
 
#define VendorSpecific   (1<<22) /* Vendor specific instruction */
 
#define NoAccess   (1<<23) /* Don't access memory (lea/invlpg/verr etc) */
 
#define Op3264   (1<<24) /* Operand is 64b in long mode, 32b otherwise */
 
#define Undefined   (1<<25) /* No Such Instruction */
 
#define Lock   (1<<26) /* lock prefix is allowed for the instruction */
 
#define Priv   (1<<27) /* instruction generates #GP if current CPL != 0 */
 
#define No64   (1<<28)
 
#define PageTable   (1 << 29) /* instruction used to write page table */
 
#define Src2Shift   (30)
 
#define Src2None   (OpNone << Src2Shift)
 
#define Src2CL   (OpCL << Src2Shift)
 
#define Src2ImmByte   (OpImmByte << Src2Shift)
 
#define Src2One   (OpOne << Src2Shift)
 
#define Src2Imm   (OpImm << Src2Shift)
 
#define Src2ES   (OpES << Src2Shift)
 
#define Src2CS   (OpCS << Src2Shift)
 
#define Src2SS   (OpSS << Src2Shift)
 
#define Src2DS   (OpDS << Src2Shift)
 
#define Src2FS   (OpFS << Src2Shift)
 
#define Src2GS   (OpGS << Src2Shift)
 
#define Src2Mask   (OpMask << Src2Shift)
 
#define Mmx   ((u64)1 << 40) /* MMX Vector instruction */
 
#define Aligned   ((u64)1 << 41) /* Explicitly aligned (e.g. MOVDQA) */
 
#define Unaligned   ((u64)1 << 42) /* Explicitly unaligned (e.g. MOVDQU) */
 
#define Avx   ((u64)1 << 43) /* Advanced Vector Extensions */
 
#define X2(x...)   x, x
 
#define X3(x...)   X2(x), x
 
#define X4(x...)   X2(x), X2(x)
 
#define X5(x...)   X4(x), x
 
#define X6(x...)   X4(x), X2(x)
 
#define X7(x...)   X4(x), X3(x)
 
#define X8(x...)   X4(x), X4(x)
 
#define X16(x...)   X8(x), X8(x)
 
#define EFLG_ID   (1<<21)
 
#define EFLG_VIP   (1<<20)
 
#define EFLG_VIF   (1<<19)
 
#define EFLG_AC   (1<<18)
 
#define EFLG_VM   (1<<17)
 
#define EFLG_RF   (1<<16)
 
#define EFLG_IOPL   (3<<12)
 
#define EFLG_NT   (1<<14)
 
#define EFLG_OF   (1<<11)
 
#define EFLG_DF   (1<<10)
 
#define EFLG_IF   (1<<9)
 
#define EFLG_TF   (1<<8)
 
#define EFLG_SF   (1<<7)
 
#define EFLG_ZF   (1<<6)
 
#define EFLG_AF   (1<<4)
 
#define EFLG_PF   (1<<2)
 
#define EFLG_CF   (1<<0)
 
#define EFLG_RESERVED_ZEROS_MASK   0xffc0802a
 
#define EFLG_RESERVED_ONE_MASK   2
 
#define EFLAGS_MASK   (EFLG_OF|EFLG_SF|EFLG_ZF|EFLG_AF|EFLG_PF|EFLG_CF)
 
#define _PRE_EFLAGS(_sav, _msk, _tmp)
 
#define _POST_EFLAGS(_sav, _msk, _tmp)
 
#define ON64(x)
 
#define ____emulate_2op(ctxt, _op, _x, _y, _suffix, _dsttype)
 
#define __emulate_2op_nobyte(ctxt, _op, _wx, _wy, _lx, _ly, _qx, _qy)
 
#define __emulate_2op(ctxt, _op, _bx, _by, _wx, _wy, _lx, _ly, _qx, _qy)
 
#define emulate_2op_SrcB(ctxt, _op)   __emulate_2op(ctxt, _op, "b", "c", "b", "c", "b", "c", "b", "c")
 
#define emulate_2op_SrcV(ctxt, _op)   __emulate_2op(ctxt, _op, "b", "q", "w", "r", _LO32, "r", "", "r")
 
#define emulate_2op_SrcV_nobyte(ctxt, _op)   __emulate_2op_nobyte(ctxt, _op, "w", "r", _LO32, "r", "", "r")
 
#define __emulate_2op_cl(ctxt, _op, _suffix, _type)
 
#define emulate_2op_cl(ctxt, _op)
 
#define __emulate_1op(ctxt, _op, _suffix)
 
#define emulate_1op(ctxt, _op)
 
#define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex)
 
#define emulate_1op_rax_rdx(ctxt, _op, _ex)
 
#define insn_fetch(_type, _ctxt)
 
#define insn_fetch_arr(_arr, _size, _ctxt)
 
#define D(_y)   { .flags = (_y) }
 
#define DI(_y, _i)   { .flags = (_y), .intercept = x86_intercept_##_i }
 
#define DIP(_y, _i, _p)
 
#define N   D(0)
 
#define EXT(_f, _e)   { .flags = ((_f) | RMExt), .u.group = (_e) }
 
#define G(_f, _g)   { .flags = ((_f) | Group | ModRM), .u.group = (_g) }
 
#define GD(_f, _g)   { .flags = ((_f) | GroupDual | ModRM), .u.gdual = (_g) }
 
#define I(_f, _e)   { .flags = (_f), .u.execute = (_e) }
 
#define II(_f, _e, _i)   { .flags = (_f), .u.execute = (_e), .intercept = x86_intercept_##_i }
 
#define IIP(_f, _e, _i, _p)
 
#define GP(_f, _g)   { .flags = ((_f) | Prefix), .u.gprefix = (_g) }
 
#define D2bv(_f)   D((_f) | ByteOp), D(_f)
 
#define D2bvIP(_f, _i, _p)   DIP((_f) | ByteOp, _i, _p), DIP(_f, _i, _p)
 
#define I2bv(_f, _e)   I((_f) | ByteOp, _e), I(_f, _e)
 
#define I2bvIP(_f, _e, _i, _p)   IIP((_f) | ByteOp, _e, _i, _p), IIP(_f, _e, _i, _p)
 
#define I6ALU(_f, _e)
 

Functions

int emulate_int_real (struct x86_emulate_ctxt *ctxt, int irq)
 
int emulator_task_switch (struct x86_emulate_ctxt *ctxt, u16 tss_selector, int idt_index, int reason, bool has_error_code, u32 error_code)
 
int x86_decode_insn (struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
 
bool x86_page_table_writing_insn (struct x86_emulate_ctxt *ctxt)
 
int x86_emulate_insn (struct x86_emulate_ctxt *ctxt)
 
void emulator_invalidate_register_cache (struct x86_emulate_ctxt *ctxt)
 
void emulator_writeback_register_cache (struct x86_emulate_ctxt *ctxt)
 

Macro Definition Documentation

#define ____emulate_2op (   ctxt,
  _op,
  _x,
  _y,
  _suffix,
  _dsttype 
)
Value:
do { \
__asm__ __volatile__ ( \
_PRE_EFLAGS("0", "4", "2") \
_op _suffix " %"_x"3,%1; " \
_POST_EFLAGS("0", "4", "2") \
: "=m" ((ctxt)->eflags), \
"+q" (*(_dsttype*)&(ctxt)->dst.val), \
"=&r" (_tmp) \
: _y ((ctxt)->src.val), "i" (EFLAGS_MASK)); \
} while (0)

Definition at line 293 of file emulate.c.

#define __emulate_1op (   ctxt,
  _op,
  _suffix 
)
Value:
do { \
unsigned long _tmp; \
\
__asm__ __volatile__ ( \
_PRE_EFLAGS("0", "3", "2") \
_op _suffix " %1; " \
_POST_EFLAGS("0", "3", "2") \
: "=m" ((ctxt)->eflags), "+m" ((ctxt)->dst.val), \
"=&r" (_tmp) \
: "i" (EFLAGS_MASK)); \
} while (0)

Definition at line 386 of file emulate.c.

#define __emulate_1op_rax_rdx (   ctxt,
  _op,
  _suffix,
  _ex 
)
Value:
do { \
unsigned long _tmp; \
ulong *rax = reg_rmw((ctxt), VCPU_REGS_RAX); \
ulong *rdx = reg_rmw((ctxt), VCPU_REGS_RDX); \
\
__asm__ __volatile__ ( \
_PRE_EFLAGS("0", "5", "1") \
"1: \n\t" \
_op _suffix " %6; " \
"2: \n\t" \
_POST_EFLAGS("0", "5", "1") \
".pushsection .fixup,\"ax\" \n\t" \
"3: movb $1, %4 \n\t" \
"jmp 2b \n\t" \
".popsection \n\t" \
: "=m" ((ctxt)->eflags), "=&r" (_tmp), \
"+a" (*rax), "+d" (*rdx), "+qm"(_ex) \
: "i" (EFLAGS_MASK), "m" ((ctxt)->src.val)); \
} while (0)

Definition at line 410 of file emulate.c.

#define __emulate_2op (   ctxt,
  _op,
  _bx,
  _by,
  _wx,
  _wy,
  _lx,
  _ly,
  _qx,
  _qy 
)
Value:
do { \
unsigned long _tmp; \
switch ((ctxt)->dst.bytes) { \
case 1: \
____emulate_2op(ctxt,_op,_bx,_by,"b",u8); \
break; \
default: \
__emulate_2op_nobyte(ctxt, _op, \
_wx, _wy, _lx, _ly, _qx, _qy); \
break; \
} \
} while (0)

Definition at line 324 of file emulate.c.

#define __emulate_2op_cl (   ctxt,
  _op,
  _suffix,
  _type 
)
Value:
do { \
unsigned long _tmp; \
_type _clv = (ctxt)->src2.val; \
_type _srcv = (ctxt)->src.val; \
_type _dstv = (ctxt)->dst.val; \
\
__asm__ __volatile__ ( \
_PRE_EFLAGS("0", "5", "2") \
_op _suffix " %4,%1 \n" \
_POST_EFLAGS("0", "5", "2") \
: "=m" ((ctxt)->eflags), "+r" (_dstv), "=&r" (_tmp) \
: "c" (_clv) , "r" (_srcv), "i" (EFLAGS_MASK) \
); \
\
(ctxt)->src2.val = (unsigned long) _clv; \
(ctxt)->src2.val = (unsigned long) _srcv; \
(ctxt)->dst.val = (unsigned long) _dstv; \
} while (0)

Definition at line 351 of file emulate.c.

#define __emulate_2op_nobyte (   ctxt,
  _op,
  _wx,
  _wy,
  _lx,
  _ly,
  _qx,
  _qy 
)
Value:
do { \
unsigned long _tmp; \
\
switch ((ctxt)->dst.bytes) { \
case 2: \
____emulate_2op(ctxt,_op,_wx,_wy,"w",u16); \
break; \
case 4: \
____emulate_2op(ctxt,_op,_lx,_ly,"l",u32); \
break; \
case 8: \
ON64(____emulate_2op(ctxt,_op,_qx,_qy,"q",u64)); \
break; \
} \
} while (0)

Definition at line 307 of file emulate.c.

#define _POST_EFLAGS (   _sav,
  _msk,
  _tmp 
)
Value:
/* _sav |= EFLAGS & _msk; */ \
"pushf; " \
"pop %"_tmp"; " \
"andl %"_msk",%"_LO32 _tmp"; " \
"orl %"_LO32 _tmp",%"_sav"; "

Definition at line 280 of file emulate.c.

#define _PRE_EFLAGS (   _sav,
  _msk,
  _tmp 
)
Value:
/* EFLAGS = (_sav & _msk) | (EFLAGS & ~_msk); _sav &= ~_msk; */ \
"movl %"_sav",%"_LO32 _tmp"; " \
"push %"_tmp"; " \
"push %"_tmp"; " \
"movl %"_msk",%"_LO32 _tmp"; " \
"andl %"_LO32 _tmp",("_STK"); " \
"pushf; " \
"notl %"_LO32 _tmp"; " \
"andl %"_LO32 _tmp",("_STK"); " \
"andl %"_LO32 _tmp","__stringify(BITS_PER_LONG/4)"("_STK"); " \
"pop %"_tmp"; " \
"orl %"_LO32 _tmp",("_STK"); " \
"popf; " \
"pop %"_sav"; "

Definition at line 263 of file emulate.c.

#define Aligned   ((u64)1 << 41) /* Explicitly aligned (e.g. MOVDQA) */

Definition at line 146 of file emulate.c.

#define Avx   ((u64)1 << 43) /* Advanced Vector Extensions */

Definition at line 148 of file emulate.c.

#define BitOp   (1<<11)

Definition at line 107 of file emulate.c.

#define ByteOp   (1<<0) /* 8-bit operands. */

Definition at line 75 of file emulate.c.

#define D (   _y)    { .flags = (_y) }

Definition at line 3566 of file emulate.c.

#define D2bv (   _f)    D((_f) | ByteOp), D(_f)

Definition at line 3582 of file emulate.c.

#define D2bvIP (   _f,
  _i,
  _p 
)    DIP((_f) | ByteOp, _i, _p), DIP(_f, _i, _p)

Definition at line 3583 of file emulate.c.

#define DI (   _y,
  _i 
)    { .flags = (_y), .intercept = x86_intercept_##_i }

Definition at line 3567 of file emulate.c.

#define DIP (   _y,
  _i,
  _p 
)
Value:
{ .flags = (_y), .intercept = x86_intercept_##_i, \
.check_perm = (_p) }

Definition at line 3568 of file emulate.c.

#define DstAcc   (OpAcc << DstShift)

Definition at line 81 of file emulate.c.

#define DstDI   (OpDI << DstShift)

Definition at line 82 of file emulate.c.

#define DstDX   (OpDX << DstShift)

Definition at line 85 of file emulate.c.

#define DstImmUByte   (OpImmUByte << DstShift)

Definition at line 84 of file emulate.c.

#define DstMask   (OpMask << DstShift)

Definition at line 86 of file emulate.c.

#define DstMem   (OpMem << DstShift)

Definition at line 80 of file emulate.c.

#define DstMem64   (OpMem64 << DstShift)

Definition at line 83 of file emulate.c.

#define DstReg   (OpReg << DstShift)

Definition at line 79 of file emulate.c.

#define DstShift   1

Definition at line 77 of file emulate.c.

#define EFLAGS_MASK   (EFLG_OF|EFLG_SF|EFLG_ZF|EFLG_AF|EFLG_PF|EFLG_CF)

Definition at line 260 of file emulate.c.

#define EFLG_AC   (1<<18)

Definition at line 187 of file emulate.c.

#define EFLG_AF   (1<<4)

Definition at line 198 of file emulate.c.

#define EFLG_CF   (1<<0)

Definition at line 200 of file emulate.c.

#define EFLG_DF   (1<<10)

Definition at line 193 of file emulate.c.

#define EFLG_ID   (1<<21)

Definition at line 184 of file emulate.c.

#define EFLG_IF   (1<<9)

Definition at line 194 of file emulate.c.

#define EFLG_IOPL   (3<<12)

Definition at line 190 of file emulate.c.

#define EFLG_NT   (1<<14)

Definition at line 191 of file emulate.c.

#define EFLG_OF   (1<<11)

Definition at line 192 of file emulate.c.

#define EFLG_PF   (1<<2)

Definition at line 199 of file emulate.c.

#define EFLG_RESERVED_ONE_MASK   2

Definition at line 203 of file emulate.c.

#define EFLG_RESERVED_ZEROS_MASK   0xffc0802a

Definition at line 202 of file emulate.c.

#define EFLG_RF   (1<<16)

Definition at line 189 of file emulate.c.

#define EFLG_SF   (1<<7)

Definition at line 196 of file emulate.c.

#define EFLG_TF   (1<<8)

Definition at line 195 of file emulate.c.

#define EFLG_VIF   (1<<19)

Definition at line 186 of file emulate.c.

#define EFLG_VIP   (1<<20)

Definition at line 185 of file emulate.c.

#define EFLG_VM   (1<<17)

Definition at line 188 of file emulate.c.

#define EFLG_ZF   (1<<6)

Definition at line 197 of file emulate.c.

#define emulate_1op (   ctxt,
  _op 
)
Value:
do { \
switch ((ctxt)->dst.bytes) { \
case 1: __emulate_1op(ctxt, _op, "b"); break; \
case 2: __emulate_1op(ctxt, _op, "w"); break; \
case 4: __emulate_1op(ctxt, _op, "l"); break; \
case 8: ON64(__emulate_1op(ctxt, _op, "q")); break; \
} \
} while (0)

Definition at line 400 of file emulate.c.

#define emulate_1op_rax_rdx (   ctxt,
  _op,
  _ex 
)
Value:
do { \
switch((ctxt)->src.bytes) { \
case 1: \
__emulate_1op_rax_rdx(ctxt, _op, "b", _ex); \
break; \
case 2: \
__emulate_1op_rax_rdx(ctxt, _op, "w", _ex); \
break; \
case 4: \
__emulate_1op_rax_rdx(ctxt, _op, "l", _ex); \
break; \
case 8: ON64( \
__emulate_1op_rax_rdx(ctxt, _op, "q", _ex)); \
break; \
} \
} while (0)

Definition at line 433 of file emulate.c.

#define emulate_2op_cl (   ctxt,
  _op 
)
Value:
do { \
switch ((ctxt)->dst.bytes) { \
case 2: \
__emulate_2op_cl(ctxt, _op, "w", u16); \
break; \
case 4: \
__emulate_2op_cl(ctxt, _op, "l", u32); \
break; \
case 8: \
ON64(__emulate_2op_cl(ctxt, _op, "q", ulong)); \
break; \
} \
} while (0)

Definition at line 371 of file emulate.c.

#define emulate_2op_SrcB (   ctxt,
  _op 
)    __emulate_2op(ctxt, _op, "b", "c", "b", "c", "b", "c", "b", "c")

Definition at line 339 of file emulate.c.

#define emulate_2op_SrcV (   ctxt,
  _op 
)    __emulate_2op(ctxt, _op, "b", "q", "w", "r", _LO32, "r", "", "r")

Definition at line 343 of file emulate.c.

#define emulate_2op_SrcV_nobyte (   ctxt,
  _op 
)    __emulate_2op_nobyte(ctxt, _op, "w", "r", _LO32, "r", "", "r")

Definition at line 347 of file emulate.c.

#define EXT (   _f,
  _e 
)    { .flags = ((_f) | RMExt), .u.group = (_e) }

Definition at line 3571 of file emulate.c.

#define G (   _f,
  _g 
)    { .flags = ((_f) | Group | ModRM), .u.group = (_g) }

Definition at line 3572 of file emulate.c.

#define GD (   _f,
  _g 
)    { .flags = ((_f) | GroupDual | ModRM), .u.gdual = (_g) }

Definition at line 3573 of file emulate.c.

#define GP (   _f,
  _g 
)    { .flags = ((_f) | Prefix), .u.gprefix = (_g) }

Definition at line 3580 of file emulate.c.

#define Group   (1<<15) /* Bits 3:5 of modrm byte extend opcode */

Definition at line 112 of file emulate.c.

#define GroupDual   (2<<15) /* Alternate decoding of mod == 3 */

Definition at line 113 of file emulate.c.

#define GroupMask   (7<<15) /* Opcode uses one of the group mechanisms */

Definition at line 111 of file emulate.c.

#define I (   _f,
  _e 
)    { .flags = (_f), .u.execute = (_e) }

Definition at line 3574 of file emulate.c.

#define I2bv (   _f,
  _e 
)    I((_f) | ByteOp, _e), I(_f, _e)

Definition at line 3584 of file emulate.c.

#define I2bvIP (   _f,
  _e,
  _i,
  _p 
)    IIP((_f) | ByteOp, _e, _i, _p), IIP(_f, _e, _i, _p)

Definition at line 3585 of file emulate.c.

#define I6ALU (   _f,
  _e 
)
Value:
I2bv((_f) | DstMem | SrcReg | ModRM, _e), \
I2bv(((_f) | DstReg | SrcMem | ModRM) & ~Lock, _e), \
I2bv(((_f) & ~Lock) | DstAcc | SrcImm, _e)

Definition at line 3588 of file emulate.c.

#define II (   _f,
  _e,
  _i 
)    { .flags = (_f), .u.execute = (_e), .intercept = x86_intercept_##_i }

Definition at line 3575 of file emulate.c.

#define IIP (   _f,
  _e,
  _i,
  _p 
)
Value:
{ .flags = (_f), .u.execute = (_e), .intercept = x86_intercept_##_i, \
.check_perm = (_p) }

Definition at line 3577 of file emulate.c.

#define ImplicitOps   (OpImplicit << DstShift)

Definition at line 78 of file emulate.c.

#define insn_fetch (   _type,
  _ctxt 
)
Value:
({ unsigned long _x; \
rc = do_insn_fetch(_ctxt, &_x, sizeof(_type)); \
if (rc != X86EMUL_CONTINUE) \
goto done; \
(_type)_x; \
})

Definition at line 806 of file emulate.c.

#define insn_fetch_arr (   _arr,
  _size,
  _ctxt 
)
Value:
({ rc = do_insn_fetch(_ctxt, _arr, (_size)); \
if (rc != X86EMUL_CONTINUE) \
goto done; \
})

Definition at line 814 of file emulate.c.

#define Lock   (1<<26) /* lock prefix is allowed for the instruction */

Definition at line 127 of file emulate.c.

#define MemAbs   (1<<12) /* Memory operand is absolute displacement */

Definition at line 108 of file emulate.c.

#define Mmx   ((u64)1 << 40) /* MMX Vector instruction */

Definition at line 145 of file emulate.c.

#define ModRM   (1<<19)

Definition at line 118 of file emulate.c.

#define Mov   (1<<20)

Definition at line 120 of file emulate.c.

#define N   D(0)

Definition at line 3570 of file emulate.c.

#define No64   (1<<28)

Definition at line 129 of file emulate.c.

#define NoAccess   (1<<23) /* Don't access memory (lea/invlpg/verr etc) */

Definition at line 124 of file emulate.c.

#define ON64 (   x)

Definition at line 290 of file emulate.c.

#define Op3264   (1<<24) /* Operand is 64b in long mode, 32b otherwise */

Definition at line 125 of file emulate.c.

#define OpAcc   4ull /* Accumulator: AL/AX/EAX/RAX */

Definition at line 38 of file emulate.c.

#define OpBits   5 /* Width of operand field */

Definition at line 62 of file emulate.c.

#define OpCL   9ull /* CL register (for shifts) */

Definition at line 43 of file emulate.c.

#define OpCS   21ull /* CS */

Definition at line 55 of file emulate.c.

#define OpDI   5ull /* ES:DI/EDI/RDI */

Definition at line 39 of file emulate.c.

#define OpDS   23ull /* DS */

Definition at line 57 of file emulate.c.

#define OpDX   8ull /* DX register */

Definition at line 42 of file emulate.c.

#define OpES   20ull /* ES */

Definition at line 54 of file emulate.c.

#define OpFS   24ull /* FS */

Definition at line 58 of file emulate.c.

#define OpGS   25ull /* GS */

Definition at line 59 of file emulate.c.

#define OpImm   12ull /* Sign extended immediate */

Definition at line 46 of file emulate.c.

#define OpImmByte   10ull /* 8-bit sign extended immediate */

Definition at line 44 of file emulate.c.

#define OpImmFAddr   17ull /* Immediate far address */

Definition at line 51 of file emulate.c.

#define OpImmU   15ull /* Immediate operand, zero extended */

Definition at line 49 of file emulate.c.

#define OpImmU16   19ull /* Immediate operand, 16 bits, zero extended */

Definition at line 53 of file emulate.c.

#define OpImmUByte   7ull /* Zero-extended 8-bit immediate */

Definition at line 41 of file emulate.c.

#define OpImplicit   1ull /* No generic decode */

Definition at line 35 of file emulate.c.

#define OpMask   ((1ull << OpBits) - 1)

Definition at line 63 of file emulate.c.

#define OpMem   3ull /* Memory */

Definition at line 37 of file emulate.c.

#define OpMem16   13ull /* Memory operand (16-bit). */

Definition at line 47 of file emulate.c.

#define OpMem32   14ull /* Memory operand (32-bit). */

Definition at line 48 of file emulate.c.

#define OpMem64   6ull /* Memory, 64-bit */

Definition at line 40 of file emulate.c.

#define OpMem8   26ull /* 8-bit zero extended memory operand */

Definition at line 60 of file emulate.c.

#define OpMemFAddr   18ull /* Far address in memory */

Definition at line 52 of file emulate.c.

#define OpNone   0ull

Definition at line 34 of file emulate.c.

#define OpOne   11ull /* Implied 1 */

Definition at line 45 of file emulate.c.

#define OpReg   2ull /* Register */

Definition at line 36 of file emulate.c.

#define OpSI   16ull /* SI/ESI/RSI */

Definition at line 50 of file emulate.c.

#define OpSS   22ull /* SS */

Definition at line 56 of file emulate.c.

#define PageTable   (1 << 29) /* instruction used to write page table */

Definition at line 130 of file emulate.c.

#define Prefix   (3<<15) /* Instruction varies with 66/f2/f3 prefix */

Definition at line 114 of file emulate.c.

#define Priv   (1<<27) /* instruction generates #GP if current CPL != 0 */

Definition at line 128 of file emulate.c.

#define Prot   (1<<21) /* instruction generates #UD if not in prot-mode */

Definition at line 122 of file emulate.c.

#define RMExt   (4<<15) /* Opcode extension in ModRM r/m if mod == 3 */

Definition at line 115 of file emulate.c.

#define Src2CL   (OpCL << Src2Shift)

Definition at line 134 of file emulate.c.

#define Src2CS   (OpCS << Src2Shift)

Definition at line 139 of file emulate.c.

#define Src2DS   (OpDS << Src2Shift)

Definition at line 141 of file emulate.c.

#define Src2ES   (OpES << Src2Shift)

Definition at line 138 of file emulate.c.

#define Src2FS   (OpFS << Src2Shift)

Definition at line 142 of file emulate.c.

#define Src2GS   (OpGS << Src2Shift)

Definition at line 143 of file emulate.c.

#define Src2Imm   (OpImm << Src2Shift)

Definition at line 137 of file emulate.c.

#define Src2ImmByte   (OpImmByte << Src2Shift)

Definition at line 135 of file emulate.c.

#define Src2Mask   (OpMask << Src2Shift)

Definition at line 144 of file emulate.c.

#define Src2None   (OpNone << Src2Shift)

Definition at line 133 of file emulate.c.

#define Src2One   (OpOne << Src2Shift)

Definition at line 136 of file emulate.c.

#define Src2Shift   (30)

Definition at line 132 of file emulate.c.

#define Src2SS   (OpSS << Src2Shift)

Definition at line 140 of file emulate.c.

#define SrcAcc   (OpAcc << SrcShift)

Definition at line 102 of file emulate.c.

#define SrcDX   (OpDX << SrcShift)

Definition at line 104 of file emulate.c.

#define SrcImm   (OpImm << SrcShift)

Definition at line 94 of file emulate.c.

#define SrcImmByte   (OpImmByte << SrcShift)

Definition at line 95 of file emulate.c.

#define SrcImmFAddr   (OpImmFAddr << SrcShift)

Definition at line 100 of file emulate.c.

#define SrcImmU   (OpImmU << SrcShift)

Definition at line 98 of file emulate.c.

#define SrcImmU16   (OpImmU16 << SrcShift)

Definition at line 103 of file emulate.c.

#define SrcImmUByte   (OpImmUByte << SrcShift)

Definition at line 97 of file emulate.c.

#define SrcMask   (OpMask << SrcShift)

Definition at line 106 of file emulate.c.

#define SrcMem   (OpMem << SrcShift)

Definition at line 91 of file emulate.c.

#define SrcMem16   (OpMem16 << SrcShift)

Definition at line 92 of file emulate.c.

#define SrcMem32   (OpMem32 << SrcShift)

Definition at line 93 of file emulate.c.

#define SrcMem8   (OpMem8 << SrcShift)

Definition at line 105 of file emulate.c.

#define SrcMemFAddr   (OpMemFAddr << SrcShift)

Definition at line 101 of file emulate.c.

#define SrcNone   (OpNone << SrcShift)

Definition at line 89 of file emulate.c.

#define SrcOne   (OpOne << SrcShift)

Definition at line 96 of file emulate.c.

#define SrcReg   (OpReg << SrcShift)

Definition at line 90 of file emulate.c.

#define SrcShift   6

Definition at line 88 of file emulate.c.

#define SrcSI   (OpSI << SrcShift)

Definition at line 99 of file emulate.c.

#define Sse   (1<<18) /* SSE Vector instruction */

Definition at line 116 of file emulate.c.

#define Stack   (1<<14) /* Stack instruction (push/pop) */

Definition at line 110 of file emulate.c.

#define String   (1<<13) /* String instruction (rep capable) */

Definition at line 109 of file emulate.c.

#define Unaligned   ((u64)1 << 42) /* Explicitly unaligned (e.g. MOVDQU) */

Definition at line 147 of file emulate.c.

#define Undefined   (1<<25) /* No Such Instruction */

Definition at line 126 of file emulate.c.

#define VendorSpecific   (1<<22) /* Vendor specific instruction */

Definition at line 123 of file emulate.c.

#define X16 (   x...)    X8(x), X8(x)

Definition at line 157 of file emulate.c.

#define X2 (   x...)    x, x

Definition at line 150 of file emulate.c.

#define X3 (   x...)    X2(x), x

Definition at line 151 of file emulate.c.

#define X4 (   x...)    X2(x), X2(x)

Definition at line 152 of file emulate.c.

#define X5 (   x...)    X4(x), x

Definition at line 153 of file emulate.c.

#define X6 (   x...)    X4(x), X2(x)

Definition at line 154 of file emulate.c.

#define X7 (   x...)    X4(x), X3(x)

Definition at line 155 of file emulate.c.

#define X8 (   x...)    X4(x), X4(x)

Definition at line 156 of file emulate.c.

Function Documentation

int emulate_int_real ( struct x86_emulate_ctxt ctxt,
int  irq 
)

Definition at line 1811 of file emulate.c.

void emulator_invalidate_register_cache ( struct x86_emulate_ctxt ctxt)

Definition at line 4707 of file emulate.c.

int emulator_task_switch ( struct x86_emulate_ctxt ctxt,
u16  tss_selector,
int  idt_index,
int  reason,
bool  has_error_code,
u32  error_code 
)

Definition at line 2786 of file emulate.c.

void emulator_writeback_register_cache ( struct x86_emulate_ctxt ctxt)

Definition at line 4712 of file emulate.c.

int x86_decode_insn ( struct x86_emulate_ctxt ctxt,
void insn,
int  insn_len 
)

Definition at line 4092 of file emulate.c.

int x86_emulate_insn ( struct x86_emulate_ctxt ctxt)

Definition at line 4357 of file emulate.c.

bool x86_page_table_writing_insn ( struct x86_emulate_ctxt ctxt)

Definition at line 4302 of file emulate.c.