Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Classes | Functions | Variables
miasm2.arch.x86.sem Namespace Reference

Classes

class  ir_x86_16
 
class  ir_x86_32
 
class  ir_x86_64
 

Functions

def update_flag_zf
 
def update_flag_nf
 
def update_flag_pf
 
def update_flag_af
 
def update_flag_znp
 
def update_flag_logic
 
def update_flag_arith
 
def check_ops_msb
 
def arith_flag
 
def update_flag_add_cf
 
def update_flag_add_of
 
def update_flag_sub_cf
 
def update_flag_sub_of
 
def update_flag_add
 
def update_flag_sub
 
def set_float_cs_eip
 
def mem2double
 
def float_implicit_st0
 
def gen_jcc
 
def gen_fcmov
 
def gen_cmov
 
def mov
 
def xchg
 
def movzx
 
def movsx
 
def lea
 
def add
 
def xadd
 
def adc
 
def sub
 
def sbb
 
def neg
 
def l_not
 
def l_cmp
 
def xor
 
def pxor
 
def l_or
 
def l_and
 
def l_test
 
def get_shift
 
def l_rol
 
def l_ror
 
def rcl
 
def rcr
 
def sar
 
def shr
 
def shrd_cl
 
def shrd
 
def sal
 
def shl
 
def shld_cl
 
def shld
 
def cmc
 
def clc
 
def stc
 
def cld
 
def std
 
def cli
 
def sti
 
def inc
 
def dec
 
def push_gen
 
def push
 
def pushw
 
def pop_gen
 
def pop
 
def popw
 
def sete
 
def setnz
 
def setl
 
def setg
 
def setge
 
def seta
 
def setae
 
def setb
 
def setbe
 
def setns
 
def sets
 
def seto
 
def setp
 
def setnp
 
def setle
 
def setna
 
def setnbe
 
def setno
 
def setnb
 
def setalc
 
def bswap
 
def cmps
 
def scas
 
def compose_eflag
 
def pushfd
 
def pushfq
 
def pushfw
 
def popfd
 
def popfw
 
def pushad
 
def popad
 
def call
 
def ret
 
def retf
 
def leave
 
def enter
 
def jmp
 
def jmpf
 
def jz
 
def jcxz
 
def jecxz
 
def jrcxz
 
def jnz
 
def jp
 
def jnp
 
def ja
 
def jae
 
def jb
 
def jbe
 
def jge
 
def jg
 
def jl
 
def jle
 
def js
 
def jns
 
def jo
 
def jno
 
def loop
 
def loopne
 
def loope
 
def div
 
def idiv
 
def mul
 
def imul
 
def cbw
 
def cwde
 
def cdqe
 
def cwd
 
def cdq
 
def cqo
 
def stos
 
def lods
 
def movs
 
def movsd
 
def movsd_dispatch
 
def float_prev
 
def float_pop
 
def fcom
 
def ftst
 
def fxam
 
def ficom
 
def fcomi
 
def fcomip
 
def fucomi
 
def fucomip
 
def fcomp
 
def fcompp
 
def ficomp
 
def fucom
 
def fucomp
 
def fucompp
 
def comiss
 
def comisd
 
def fld
 
def fst
 
def fstp
 
def fist
 
def fistp
 
def fisttp
 
def fild
 
def fldz
 
def fld1
 
def fldl2t
 
def fldpi
 
def fldln2
 
def fldl2e
 
def fldlg2
 
def fadd
 
def fiadd
 
def fisub
 
def fisubr
 
def fpatan
 
def fprem
 
def fprem1
 
def faddp
 
def fninit
 
def fyl2x
 
def fnstenv
 
def fsub
 
def fsubp
 
def fsubr
 
def fsubrp
 
def fmul
 
def fimul
 
def fdiv
 
def fdivr
 
def fdivrp
 
def fidiv
 
def fidivr
 
def fdivp
 
def fmulp
 
def ftan
 
def fxch
 
def fptan
 
def frndint
 
def fsin
 
def fcos
 
def fsincos
 
def fscale
 
def f2xm1
 
def fchs
 
def fsqrt
 
def fabs
 
def fnstsw
 
def fnstcw
 
def fldcw
 
def fwait
 
def fcmovb
 
def fcmove
 
def fcmovbe
 
def fcmovu
 
def fcmovnb
 
def fcmovne
 
def fcmovnbe
 
def fcmovnu
 
def nop
 
def hlt
 
def rdtsc
 
def daa
 
def das
 
def aam
 
def aad
 
def aaa
 
def aas
 
def bsr_bsf
 
def bsf
 
def bsr
 
def arpl
 
def ins
 
def sidt
 
def sldt
 
def cmovz
 
def cmovnz
 
def cmovpe
 
def cmovnp
 
def cmovge
 
def cmovg
 
def cmovl
 
def cmovle
 
def cmova
 
def cmovae
 
def cmovbe
 
def cmovb
 
def cmovo
 
def cmovno
 
def cmovs
 
def cmovns
 
def icebp
 
def l_int
 
def l_sysenter
 
def l_out
 
def l_outs
 
def xlat
 
def cpuid
 
def bittest_get
 
def bt
 
def btc
 
def bts
 
def btr
 
def into
 
def l_in
 
def cmpxchg
 
def lds
 
def les
 
def lss
 
def lfs
 
def lgs
 
def lahf
 
def sahf
 
def lar
 
def lsl
 
def fclex
 
def fnclex
 
def l_str
 
def movd
 
def movdqu
 
def movapd
 
def andps
 
def orps
 
def xorps
 
def rdmsr
 
def wrmsr
 
def vec_op_clip
 MMX/SSE/AVX operations. More...
 
def vec_vertical_sem
 
def float_vec_vertical_sem
 
def __vec_vertical_instr_gen
 
def vec_vertical_instr
 
def float_vec_vertical_instr
 
def pand
 Logical (floating-point) More...
 
def por
 
def pminsw
 
def cvtdq2pd
 
def cvtdq2ps
 
def cvtpd2dq
 
def cvtpd2pi
 
def cvtpd2ps
 
def cvtpi2pd
 
def cvtpi2ps
 
def cvtps2dq
 
def cvtps2pd
 
def cvtps2pi
 
def cvtsd2si
 
def cvtsd2ss
 
def cvtsi2sd
 
def cvtsi2ss
 
def cvtss2sd
 
def cvtss2si
 
def cvttpd2pi
 
def cvttpd2dq
 
def cvttps2dq
 
def cvttps2pi
 
def cvttsd2si
 
def cvttss2si
 
def movss
 
def ucomiss
 

Variables

tuple EXCEPT_SOFT_BP = (1 << 1)
 
tuple EXCEPT_INT_XX = (1 << 2)
 
tuple EXCEPT_BREAKPOINT_INTERN = (1 << 10)
 
tuple EXCEPT_NUM_UPDT_EIP = (1 << 11)
 
tuple EXCEPT_UNK_MEM_AD = (1 << 12)
 
tuple EXCEPT_THROW_SEH = (1 << 13)
 
tuple EXCEPT_UNK_EIP = (1 << 14)
 
tuple EXCEPT_ACCESS_VIOL = (1 << 14)
 
tuple EXCEPT_INT_DIV_BY_ZERO = (1 << 16)
 
tuple EXCEPT_PRIV_INSN = (1 << 17)
 
tuple EXCEPT_ILLEGAL_INSN = (1 << 18)
 
tuple EXCEPT_UNK_MNEMO = (1 << 19)
 
tuple paddb = vec_vertical_instr('+', 8)
 Integer arithmetic. More...
 
tuple paddw = vec_vertical_instr('+', 16)
 
tuple paddd = vec_vertical_instr('+', 32)
 
tuple paddq = vec_vertical_instr('+', 64)
 
tuple psubb = vec_vertical_instr('-', 8)
 Substractions. More...
 
tuple psubw = vec_vertical_instr('-', 16)
 
tuple psubd = vec_vertical_instr('-', 32)
 
tuple psubq = vec_vertical_instr('-', 64)
 
tuple addss = vec_op_clip('+', 32)
 Floating-point arithmetic. More...
 
tuple addsd = vec_op_clip('+', 64)
 
tuple addps = float_vec_vertical_instr('+', 32)
 
tuple addpd = float_vec_vertical_instr('+', 64)
 
tuple subss = vec_op_clip('-', 32)
 
tuple subsd = vec_op_clip('-', 64)
 
tuple subps = float_vec_vertical_instr('-', 32)
 
tuple subpd = float_vec_vertical_instr('-', 64)
 
tuple mulss = vec_op_clip('*', 32)
 
tuple mulsd = vec_op_clip('*', 64)
 
tuple mulps = float_vec_vertical_instr('*', 32)
 
tuple mulpd = float_vec_vertical_instr('*', 64)
 
tuple divss = vec_op_clip('/', 32)
 
tuple divsd = vec_op_clip('/', 64)
 
tuple divps = float_vec_vertical_instr('/', 32)
 
tuple divpd = float_vec_vertical_instr('/', 64)
 
dictionary mnemo_func
 

Function Documentation

def miasm2.arch.x86.sem.__vec_vertical_instr_gen (   op,
  elt_size,
  sem 
)
private

Definition at line 3151 of file sem.py.

3152 def __vec_vertical_instr_gen(op, elt_size, sem):
3153  def vec_instr(ir, instr, a, b):
3154  e = []
3155  if isinstance(b, m2_expr.ExprMem):
3156  b = m2_expr.ExprMem(b.arg, a.size)
3157  reg_size = a.size
3158  e.append(m2_expr.ExprAff(a, sem(op, elt_size, reg_size, a, b)))
3159  return e, []
3160  return vec_instr
def __vec_vertical_instr_gen
Definition: sem.py:3151

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.aaa (   ir,
  instr 
)

Definition at line 2595 of file sem.py.

2596 def aaa(ir, instr, ):
2597  e = []
2598  c = (mRAX[instr.mode][:8] & m2_expr.ExprInt8(0xf)) - m2_expr.ExprInt8(9)
2599 
2600  c = m2_expr.ExprCond(c.msb(),
2601  m2_expr.ExprInt1(0),
2602  m2_expr.ExprInt1(1)) & \
2603  m2_expr.ExprCond(c,
2604  m2_expr.ExprInt1(1),
2605  m2_expr.ExprInt1(0))
2606 
2607  c |= af & m2_expr.ExprInt1(1)
2608  # set AL
2609  m_al = m2_expr.ExprCond(c,
2610  (mRAX[instr.mode][:8] + m2_expr.ExprInt8(6)) & \
2611  m2_expr.ExprInt8(0xF),
2612  mRAX[instr.mode][:8] & m2_expr.ExprInt8(0xF))
2613  m_ah = m2_expr.ExprCond(c,
2614  mRAX[instr.mode][8:16] + m2_expr.ExprInt8(1),
2615  mRAX[instr.mode][8:16])
2616 
2617  e.append(m2_expr.ExprAff(mRAX[instr.mode], m2_expr.ExprCompose([
2618  (m_al, 0, 8), (m_ah, 8, 16),
2619  (mRAX[instr.mode][16:], 16, mRAX[instr.mode].size)])))
2620  e.append(m2_expr.ExprAff(af, c))
2621  e.append(m2_expr.ExprAff(cf, c))
2622  return e, []
2623 
def miasm2.arch.x86.sem.aad (   ir,
  instr,
  a 
)

Definition at line 2580 of file sem.py.

2581 def aad(ir, instr, a):
2582  e = []
2583  tempAL = mRAX[instr.mode][0:8]
2584  tempAH = mRAX[instr.mode][8:16]
2585  newEAX = m2_expr.ExprCompose([
2586  ((tempAL + (tempAH * a)) & m2_expr.ExprInt8(0xFF), 0, 8),
2587  (m2_expr.ExprInt8(0), 8, 16),
2588  (mRAX[instr.mode][16:],
2589  16, mRAX[instr.mode].size),
2590  ])
2591  e += [m2_expr.ExprAff(mRAX[instr.mode], newEAX)]
2592  e += update_flag_arith(newEAX)
2593  return e, []
2594 
def update_flag_arith
Definition: sem.py:99

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.aam (   ir,
  instr,
  a 
)

Definition at line 2567 of file sem.py.

2568 def aam(ir, instr, a):
2569  e = []
2570  tempAL = mRAX[instr.mode][0:8]
2571  newEAX = m2_expr.ExprCompose([
2572  (tempAL % a, 0, 8),
2573  (tempAL / a, 8, 16),
2574  (mRAX[instr.mode][16:], 16, mRAX[instr.mode].size),
2575  ])
2576  e += [m2_expr.ExprAff(mRAX[instr.mode], newEAX)]
2577  e += update_flag_arith(newEAX)
2578  return e, []
2579 
def update_flag_arith
Definition: sem.py:99

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.aas (   ir,
  instr 
)

Definition at line 2624 of file sem.py.

2625 def aas(ir, instr, ):
2626  e = []
2627  c = (mRAX[instr.mode][:8] & m2_expr.ExprInt8(0xf)) - m2_expr.ExprInt8(9)
2628 
2629  c = m2_expr.ExprCond(c.msb(),
2630  m2_expr.ExprInt1(0),
2631  m2_expr.ExprInt1(1)) & \
2632  m2_expr.ExprCond(c,
2633  m2_expr.ExprInt1(1),
2634  m2_expr.ExprInt1(0))
2635 
2636  c |= af & m2_expr.ExprInt1(1)
2637  # set AL
2638  m_al = m2_expr.ExprCond(c,
2639  (mRAX[instr.mode][:8] - m2_expr.ExprInt8(6)) & \
2640  m2_expr.ExprInt8(0xF),
2641  mRAX[instr.mode][:8] & m2_expr.ExprInt8(0xF))
2642  m_ah = m2_expr.ExprCond(c,
2643  mRAX[instr.mode][8:16] - m2_expr.ExprInt8(1),
2644  mRAX[instr.mode][8:16])
2645 
2646  e.append(m2_expr.ExprAff(mRAX[instr.mode], m2_expr.ExprCompose([
2647  (m_al, 0, 8), (m_ah, 8, 16),
2648  (mRAX[instr.mode][16:], 16, mRAX[instr.mode].size)])))
2649  e.append(m2_expr.ExprAff(af, c))
2650  e.append(m2_expr.ExprAff(cf, c))
2651  return e, []
2652 
def miasm2.arch.x86.sem.adc (   ir,
  instr,
  a,
  b 
)

Definition at line 308 of file sem.py.

309 def adc(ir, instr, a, b):
310  e = []
311  c = a + (b + m2_expr.ExprCompose([(m2_expr.ExprInt(0, a.size - 1),
312  1, a.size),
313  (cf, 0, 1)]))
314  e += update_flag_arith(c)
315  e += update_flag_af(c)
316  e += update_flag_add(a, b, c)
317  e.append(m2_expr.ExprAff(a, c))
318  return e, []
319 
def update_flag_add
Definition: sem.py:143
def update_flag_arith
Definition: sem.py:99
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.add (   ir,
  instr,
  a,
  b 
)

Definition at line 287 of file sem.py.

288 def add(ir, instr, a, b):
289  e = []
290  c = a + b
291  e += update_flag_arith(c)
292  e += update_flag_af(c)
293  e += update_flag_add(a, b, c)
294  e.append(m2_expr.ExprAff(a, c))
295  return e, []
296 
def update_flag_add
Definition: sem.py:143
def update_flag_arith
Definition: sem.py:99
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.andps (   ir,
  instr,
  a,
  b 
)

Definition at line 3067 of file sem.py.

3068 def andps(ir, instr, a, b):
3069  e = []
3070  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('&', a, b)))
3071  return e, []
3072 
def miasm2.arch.x86.sem.arith_flag (   a,
  b,
  c 
)

Definition at line 110 of file sem.py.

111 def arith_flag(a, b, c):
112  a_s, b_s, c_s = a.size, b.size, c.size
113  check_ops_msb(a_s, b_s, c_s)
114  a_s, b_s, c_s = a.msb(), b.msb(), c.msb()
115  return a_s, b_s, c_s
116 
117 # checked: ok for adc add because b & c before +cf
def check_ops_msb
Definition: sem.py:105

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.arpl (   ir,
  instr,
  a,
  b 
)

Definition at line 2690 of file sem.py.

2691 def arpl(ir, instr, a, b):
2692  e = []
2693  e.append(m2_expr.ExprAff(exception_flags, m2_expr.ExprInt32(1 << 7)))
2694  return e, []
2695 
def miasm2.arch.x86.sem.bittest_get (   a,
  b 
)

Definition at line 2858 of file sem.py.

2859 def bittest_get(a, b):
2860  b = b.zeroExtend(a.size)
2861  if isinstance(a, m2_expr.ExprMem):
2862  b_mask = {16:4, 32:5, 64:6}
2863  b_decal = {16:1, 32:3, 64:7}
2864  ptr = a.arg
2865  off_bit = b.zeroExtend(a.size) & m2_expr.ExprInt((1<<b_mask[a.size])-1,
2866  a.size)
2867  off_byte = ((b.zeroExtend(ptr.size) >> m2_expr.ExprInt_from(ptr, 3)) &
2868  m2_expr.ExprInt_from(ptr,
2869  ((1<<a.size)-1) ^ b_decal[a.size]))
2870 
2871  d = m2_expr.ExprMem(ptr + off_byte, a.size)
2872  else:
2873  off_bit = m2_expr.ExprOp('&', b, m2_expr.ExprInt_from(a, a.size - 1))
2874  d = a
2875  return d, off_bit
2876 

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.bsf (   ir,
  instr,
  a,
  b 
)

Definition at line 2683 of file sem.py.

2684 def bsf(ir, instr, a, b):
2685  return bsr_bsf(ir, instr, a, b, "bsf")

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.bsr (   ir,
  instr,
  a,
  b 
)

Definition at line 2686 of file sem.py.

2687 def bsr(ir, instr, a, b):
2688  return bsr_bsf(ir, instr, a, b, "bsr")
2689 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.bsr_bsf (   ir,
  instr,
  a,
  b,
  op_name 
)
IF SRC == 0
    ZF = 1
    DEST is left unchanged
ELSE
    ZF = 0
    DEST = @op_name(SRC)

Definition at line 2653 of file sem.py.

2654 def bsr_bsf(ir, instr, a, b, op_name):
2655  """
2656  IF SRC == 0
2657  ZF = 1
2658  DEST is left unchanged
2659  ELSE
2660  ZF = 0
2661  DEST = @op_name(SRC)
2662  """
2663  lbl_src_null = m2_expr.ExprId(ir.gen_label(), instr.mode)
2664  lbl_src_not_null = m2_expr.ExprId(ir.gen_label(), instr.mode)
2665  lbl_next = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
2666 
2667  aff_dst = m2_expr.ExprAff(ir.IRDst, lbl_next)
2668  e = [m2_expr.ExprAff(ir.IRDst, m2_expr.ExprCond(b,
2669  lbl_src_not_null,
2670  lbl_src_null))]
2671  e_src_null = []
2672  e_src_null.append(m2_expr.ExprAff(zf, m2_expr.ExprInt_from(zf, 1)))
2673  # XXX destination is undefined
2674  e_src_null.append(aff_dst)
2675 
2676  e_src_not_null = []
2677  e_src_not_null.append(m2_expr.ExprAff(zf, m2_expr.ExprInt_from(zf, 0)))
2678  e_src_not_null.append(m2_expr.ExprAff(a, m2_expr.ExprOp(op_name, b)))
2679  e_src_not_null.append(aff_dst)
2680 
2681  return e, [irbloc(lbl_src_null.name, [e_src_null]),
2682  irbloc(lbl_src_not_null.name, [e_src_not_null])]

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.bswap (   ir,
  instr,
  a 
)

Definition at line 902 of file sem.py.

903 def bswap(ir, instr, a):
904  e = []
905  if a.size == 16:
906  c = m2_expr.ExprCompose([(a[:8], 8, 16),
907  (a[8:16], 0, 8),
908  ])
909  elif a.size == 32:
910  c = m2_expr.ExprCompose([(a[:8], 24, 32),
911  (a[8:16], 16, 24),
912  (a[16:24], 8, 16),
913  (a[24:32], 0, 8),
914  ])
915  elif a.size == 64:
916  c = m2_expr.ExprCompose([(a[:8], 56, 64),
917  (a[8:16], 48, 56),
918  (a[16:24], 40, 48),
919  (a[24:32], 32, 40),
920  (a[32:40], 24, 32),
921  (a[40:48], 16, 24),
922  (a[48:56], 8, 16),
923  (a[56:64], 0, 8),
924  ])
925  else:
926  raise ValueError('the size DOES matter')
927  e.append(m2_expr.ExprAff(a, c))
928  return e, []
929 
def miasm2.arch.x86.sem.bt (   ir,
  instr,
  a,
  b 
)

Definition at line 2877 of file sem.py.

2878 def bt(ir, instr, a, b):
2879  e = []
2880  b = b.zeroExtend(a.size)
2881  d, off_bit = bittest_get(a, b)
2882  d = d >> off_bit
2883  e.append(m2_expr.ExprAff(cf, d[:1]))
2884  return e, []
2885 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.btc (   ir,
  instr,
  a,
  b 
)

Definition at line 2886 of file sem.py.

2887 def btc(ir, instr, a, b):
2888  e = []
2889  d, off_bit = bittest_get(a, b)
2890  e.append(m2_expr.ExprAff(cf, (d >> off_bit)[:1]))
2891 
2892  m = m2_expr.ExprInt_from(a, 1) << off_bit
2893  e.append(m2_expr.ExprAff(d, d ^ m))
2894 
2895  return e, []
2896 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.btr (   ir,
  instr,
  a,
  b 
)

Definition at line 2907 of file sem.py.

2908 def btr(ir, instr, a, b):
2909  e = []
2910  d, off_bit = bittest_get(a, b)
2911  e.append(m2_expr.ExprAff(cf, (d >> off_bit)[:1]))
2912  m = ~(m2_expr.ExprInt_from(a, 1) << off_bit)
2913  e.append(m2_expr.ExprAff(d, d & m))
2914 
2915  return e, []
2916 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.bts (   ir,
  instr,
  a,
  b 
)

Definition at line 2897 of file sem.py.

2898 def bts(ir, instr, a, b):
2899  e = []
2900  d, off_bit = bittest_get(a, b)
2901  e.append(m2_expr.ExprAff(cf, (d >> off_bit)[:1]))
2902  m = m2_expr.ExprInt_from(a, 1) << off_bit
2903  e.append(m2_expr.ExprAff(d, d | m))
2904 
2905  return e, []
2906 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.call (   ir,
  instr,
  dst 
)

Definition at line 1120 of file sem.py.

1121 def call(ir, instr, dst):
1122  e = []
1123  # opmode, admode = instr.opmode, instr.admode
1124  s = dst.size
1125  meip = mRIP[instr.mode]
1126  opmode, admode = s, instr.v_admode()
1127  myesp = mRSP[instr.mode][:opmode]
1128  n = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
1129 
1130 
1131  if (isinstance(dst, m2_expr.ExprOp) and dst.op == "segm"):
1132  # call far
1133  if instr.mode != 16:
1134  raise NotImplementedError('add 32 bit support!')
1135  segm = dst.args[0]
1136  base = dst.args[1]
1137  m1 = segm.zeroExtend(CS.size)
1138  m2 = base.zeroExtend(meip.size)
1139  e.append(m2_expr.ExprAff(CS, m1))
1140  e.append(m2_expr.ExprAff(meip, m2))
1141 
1142  e.append(m2_expr.ExprAff(ir.IRDst, m2))
1143 
1144  c = myesp + m2_expr.ExprInt(-s/8, s)
1145  e.append(m2_expr.ExprAff(m2_expr.ExprMem(c, size=s).zeroExtend(s),
1146  CS.zeroExtend(s)))
1147 
1148  c = myesp + m2_expr.ExprInt(-2*s/8, s)
1149  e.append(m2_expr.ExprAff(m2_expr.ExprMem(c, size=s).zeroExtend(s),
1150  meip.zeroExtend(s)))
1151 
1152  c = myesp + m2_expr.ExprInt((-2*s) / 8, s)
1153  e.append(m2_expr.ExprAff(myesp, c))
1154  return e, []
1155 
1156 
1157  c = myesp + m2_expr.ExprInt((-s / 8), s)
1158  e.append(m2_expr.ExprAff(myesp, c))
1159  if ir.do_stk_segm:
1160  c = m2_expr.ExprOp('segm', SS, c)
1161  e.append(m2_expr.ExprAff(m2_expr.ExprMem(c, size=s), n))
1162  e.append(m2_expr.ExprAff(meip, dst.zeroExtend(instr.mode)))
1163  e.append(m2_expr.ExprAff(ir.IRDst, dst.zeroExtend(instr.mode)))
1164  #if not expr_is_int_or_label(dst):
1165  # dst = meip
1166  return e, []
1167 
def miasm2.arch.x86.sem.cbw (   ir,
  instr 
)

Definition at line 1551 of file sem.py.

1552 def cbw(ir, instr):
1553  e = []
1554  tempAL = mRAX[instr.mode][:8]
1555  tempAX = mRAX[instr.mode][:16]
1556  e.append(m2_expr.ExprAff(tempAX, tempAL.signExtend(16)))
1557  return e, []
1558 
def miasm2.arch.x86.sem.cdq (   ir,
  instr 
)

Definition at line 1585 of file sem.py.

1586 def cdq(ir, instr):
1587  e = []
1588  tempEAX = mRAX[instr.mode][:32]
1589  tempEDX = mRDX[instr.mode][:32]
1590  c = tempEAX.signExtend(64)
1591  e.append(m2_expr.ExprAff(tempEAX, c[:32]))
1592  e.append(m2_expr.ExprAff(tempEDX, c[32:64]))
1593  return e, []
1594 
def miasm2.arch.x86.sem.cdqe (   ir,
  instr 
)

Definition at line 1567 of file sem.py.

1568 def cdqe(ir, instr):
1569  e = []
1570  tempEAX = mRAX[instr.mode][:32]
1571  tempRAX = mRAX[instr.mode][:64]
1572  e.append(m2_expr.ExprAff(tempRAX, tempEAX.signExtend(64)))
1573  return e, []
1574 
def miasm2.arch.x86.sem.check_ops_msb (   a,
  b,
  c 
)

Definition at line 105 of file sem.py.

106 def check_ops_msb(a, b, c):
107  if not a or not b or not c or a != b or a != c:
108  raise ValueError('bad ops size %s %s %s' % (a, b, c))
109 
def check_ops_msb
Definition: sem.py:105

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.clc (   ir,
  instr 
)

Definition at line 640 of file sem.py.

641 def clc(ir, instr):
642  e = [m2_expr.ExprAff(cf, m2_expr.ExprInt_from(cf, 0))]
643  return e, []
644 
def miasm2.arch.x86.sem.cld (   ir,
  instr 
)

Definition at line 650 of file sem.py.

651 def cld(ir, instr):
652  e = [m2_expr.ExprAff(df, m2_expr.ExprInt_from(df, 0))]
653  return e, []
654 
def miasm2.arch.x86.sem.cli (   ir,
  instr 
)

Definition at line 660 of file sem.py.

661 def cli(ir, instr):
662  e = [m2_expr.ExprAff(i_f, m2_expr.ExprInt_from(i_f, 0))]
663  return e, []
664 
def miasm2.arch.x86.sem.cmc (   ir,
  instr 
)

Definition at line 634 of file sem.py.

635 def cmc(ir, instr):
636  e = [m2_expr.ExprAff(cf, m2_expr.ExprCond(cf, m2_expr.ExprInt_from(cf, 0),
637  m2_expr.ExprInt_from(cf, 1)))]
638  return e, []
639 
def miasm2.arch.x86.sem.cmova (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2753 of file sem.py.

2754 def cmova(ir, instr, arg1, arg2):
2755  return gen_cmov(ir, instr, cf|zf, arg1, arg2, False)
2756 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovae (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2757 of file sem.py.

2758 def cmovae(ir, instr, arg1, arg2):
2759  return gen_cmov(ir, instr, cf, arg1, arg2, False)
2760 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovb (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2765 of file sem.py.

2766 def cmovb(ir, instr, arg1, arg2):
2767  return gen_cmov(ir, instr, cf, arg1, arg2, True)
2768 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovbe (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2761 of file sem.py.

2762 def cmovbe(ir, instr, arg1, arg2):
2763  return gen_cmov(ir, instr, cf|zf, arg1, arg2, True)
2764 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovg (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2741 of file sem.py.

2742 def cmovg(ir, instr, arg1, arg2):
2743  return gen_cmov(ir, instr, zf|(nf^of), arg1, arg2, False)
2744 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovge (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2737 of file sem.py.

2738 def cmovge(ir, instr, arg1, arg2):
2739  return gen_cmov(ir, instr, nf^of, arg1, arg2, False)
2740 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovl (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2745 of file sem.py.

2746 def cmovl(ir, instr, arg1, arg2):
2747  return gen_cmov(ir, instr, nf^of, arg1, arg2, True)
2748 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovle (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2749 of file sem.py.

2750 def cmovle(ir, instr, arg1, arg2):
2751  return gen_cmov(ir, instr, zf|(nf^of), arg1, arg2, True)
2752 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovno (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2773 of file sem.py.

2774 def cmovno(ir, instr, arg1, arg2):
2775  return gen_cmov(ir, instr, of, arg1, arg2, False)
2776 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovnp (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2733 of file sem.py.

2734 def cmovnp(ir, instr, arg1, arg2):
2735  return gen_cmov(ir, instr, pf, arg1, arg2, False)
2736 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovns (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2781 of file sem.py.

2782 def cmovns(ir, instr, arg1, arg2):
2783  return gen_cmov(ir, instr, nf, arg1, arg2, False)
2784 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovnz (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2725 of file sem.py.

2726 def cmovnz(ir, instr, arg1, arg2):
2727  return gen_cmov(ir, instr, zf, arg1, arg2, False)
2728 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovo (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2769 of file sem.py.

2770 def cmovo(ir, instr, arg1, arg2):
2771  return gen_cmov(ir, instr, of, arg1, arg2, True)
2772 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovpe (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2729 of file sem.py.

2730 def cmovpe(ir, instr, arg1, arg2):
2731  return gen_cmov(ir, instr, pf, arg1, arg2, True)
2732 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovs (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2777 of file sem.py.

2778 def cmovs(ir, instr, arg1, arg2):
2779  return gen_cmov(ir, instr, nf, arg1, arg2, True)
2780 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmovz (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2722 of file sem.py.

2723 def cmovz(ir, instr, arg1, arg2):
2724  return gen_cmov(ir, instr, zf, arg1, arg2, True)

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmps (   ir,
  instr,
  size 
)

Definition at line 930 of file sem.py.

931 def cmps(ir, instr, size):
932  lbl_cmp = m2_expr.ExprId(ir.gen_label(), instr.mode)
933  lbl_df_0 = m2_expr.ExprId(ir.gen_label(), instr.mode)
934  lbl_df_1 = m2_expr.ExprId(ir.gen_label(), instr.mode)
935  lbl_next = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
936 
937  s = instr.v_admode()
938  a = m2_expr.ExprMem(mRDI[instr.mode][:s], size)
939  b = m2_expr.ExprMem(mRSI[instr.mode][:s], size)
940 
941  e, extra = l_cmp(ir, instr, a, b)
942 
943  e0 = []
944  e0.append(m2_expr.ExprAff(a.arg,
945  a.arg + m2_expr.ExprInt_from(a.arg, size / 8)))
946  e0.append(m2_expr.ExprAff(b.arg,
947  b.arg + m2_expr.ExprInt_from(b.arg, size / 8)))
948  e0.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
949  e0 = irbloc(lbl_df_0.name, [e0])
950 
951  e1 = []
952  e1.append(m2_expr.ExprAff(a.arg,
953  a.arg - m2_expr.ExprInt_from(a.arg, size / 8)))
954  e1.append(m2_expr.ExprAff(b.arg,
955  b.arg - m2_expr.ExprInt_from(b.arg, size / 8)))
956  e1.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
957  e1 = irbloc(lbl_df_1.name, [e1])
958 
959  e.append(m2_expr.ExprAff(ir.IRDst,
960  m2_expr.ExprCond(df, lbl_df_1, lbl_df_0)))
961  return e, [e0, e1]
962 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.cmpxchg (   ir,
  instr,
  a,
  b 
)

Definition at line 2928 of file sem.py.

2929 def cmpxchg(ir, instr, a, b):
2930  e = []
2931 
2932  c = mRAX[instr.mode][:a.size]
2933  cond = c - a
2934  e.append(
2935  m2_expr.ExprAff(zf,
2936  m2_expr.ExprCond(cond,
2937  m2_expr.ExprInt_from(zf, 0),
2938  m2_expr.ExprInt_from(zf, 1))))
2939  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(cond,
2940  b,
2941  a)
2942  ))
2943  e.append(m2_expr.ExprAff(c, m2_expr.ExprCond(cond,
2944  a,
2945  c)
2946  ))
2947  return e, []
2948 
def miasm2.arch.x86.sem.comisd (   ir,
  instr,
  a,
  b 
)

Definition at line 1931 of file sem.py.

1932 def comisd(ir, instr, a, b):
1933  # TODO unordered float
1934 
1935  e = []
1936 
1937  a = m2_expr.ExprOp('int_64_to_double', a[:64])
1938  b = m2_expr.ExprOp('int_64_to_double', b[:64])
1939 
1940  e.append(m2_expr.ExprAff(cf, m2_expr.ExprOp('fcom_c0', a, b)))
1941  e.append(m2_expr.ExprAff(pf, m2_expr.ExprOp('fcom_c2', a, b)))
1942  e.append(m2_expr.ExprAff(zf, m2_expr.ExprOp('fcom_c3', a, b)))
1943 
1944  e.append(m2_expr.ExprAff(of, m2_expr.ExprInt1(0)))
1945  e.append(m2_expr.ExprAff(nf, m2_expr.ExprInt1(0)))
1946  e.append(m2_expr.ExprAff(af, m2_expr.ExprInt1(0)))
1947 
1948  e += set_float_cs_eip(instr)
1949  return e, []
1950 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.comiss (   ir,
  instr,
  a,
  b 
)

Definition at line 1911 of file sem.py.

1912 def comiss(ir, instr, a, b):
1913  # TODO unordered float
1914 
1915  e = []
1916 
1917  a = m2_expr.ExprOp('int_32_to_float', a[:32])
1918  b = m2_expr.ExprOp('int_32_to_float', b[:32])
1919 
1920  e.append(m2_expr.ExprAff(cf, m2_expr.ExprOp('fcom_c0', a, b)))
1921  e.append(m2_expr.ExprAff(pf, m2_expr.ExprOp('fcom_c2', a, b)))
1922  e.append(m2_expr.ExprAff(zf, m2_expr.ExprOp('fcom_c3', a, b)))
1923 
1924  e.append(m2_expr.ExprAff(of, m2_expr.ExprInt1(0)))
1925  e.append(m2_expr.ExprAff(nf, m2_expr.ExprInt1(0)))
1926  e.append(m2_expr.ExprAff(af, m2_expr.ExprInt1(0)))
1927 
1928  e += set_float_cs_eip(instr)
1929  return e, []
1930 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.compose_eflag (   s = 32)

Definition at line 992 of file sem.py.

993 def compose_eflag(s=32):
994  args = []
995 
996  regs = [cf, m2_expr.ExprInt1(1), pf, m2_expr.ExprInt1(
997  0), af, m2_expr.ExprInt1(0), zf, nf, tf, i_f, df, of]
998  for i in xrange(len(regs)):
999  args.append((regs[i], i, i + 1))
1000 
1001  args.append((iopl, 12, 14))
1002 
1003  if s == 32:
1004  regs = [nt, m2_expr.ExprInt1(0), rf, vm, ac, vif, vip, i_d]
1005  elif s == 16:
1006  regs = [nt, m2_expr.ExprInt1(0)]
1007  else:
1008  raise ValueError('unk size')
1009  for i in xrange(len(regs)):
1010  args.append((regs[i], i + 14, i + 15))
1011  if s == 32:
1012  args.append((m2_expr.ExprInt(0, 10), 22, 32))
1013  return m2_expr.ExprCompose(args)
1014 
def compose_eflag
Definition: sem.py:992

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.cpuid (   ir,
  instr 
)

Definition at line 2841 of file sem.py.

2842 def cpuid(ir, instr):
2843  e = []
2844  e.append(
2845  m2_expr.ExprAff(mRAX[instr.mode],
2846  m2_expr.ExprOp('cpuid', mRAX[instr.mode], m2_expr.ExprInt(0, instr.mode))))
2847  e.append(
2848  m2_expr.ExprAff(mRBX[instr.mode],
2849  m2_expr.ExprOp('cpuid', mRAX[instr.mode], m2_expr.ExprInt(1, instr.mode))))
2850  e.append(
2851  m2_expr.ExprAff(mRCX[instr.mode],
2852  m2_expr.ExprOp('cpuid', mRAX[instr.mode], m2_expr.ExprInt(2, instr.mode))))
2853  e.append(
2854  m2_expr.ExprAff(mRDX[instr.mode],
2855  m2_expr.ExprOp('cpuid', mRAX[instr.mode], m2_expr.ExprInt(3, instr.mode))))
2856  return e, []
2857 
def miasm2.arch.x86.sem.cqo (   ir,
  instr 
)

Definition at line 1595 of file sem.py.

1596 def cqo(ir, instr):
1597  e = []
1598  tempRAX = mRAX[instr.mode][:64]
1599  tempRDX = mRDX[instr.mode][:64]
1600  c = tempRAX.signExtend(128)
1601  e.append(m2_expr.ExprAff(tempRAX, c[:64]))
1602  e.append(m2_expr.ExprAff(tempRDX, c[64:128]))
1603  return e, []
1604 
def miasm2.arch.x86.sem.cvtdq2pd (   ir,
  instr,
  a,
  b 
)

Definition at line 3233 of file sem.py.

3234 def cvtdq2pd(ir, instr, a, b):
3235  e = []
3236  e.append(m2_expr.ExprAff(a[:64], m2_expr.ExprOp('int_32_to_double', b[:32])))
3237  e.append(m2_expr.ExprAff(a[64:128], m2_expr.ExprOp('int_32_to_double', b[32:64])))
3238  return e, []
def miasm2.arch.x86.sem.cvtdq2ps (   ir,
  instr,
  a,
  b 
)

Definition at line 3239 of file sem.py.

3240 def cvtdq2ps(ir, instr, a, b):
3241  e = []
3242  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('int_32_to_float', b[:32])))
3243  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('int_32_to_float', b[32:64])))
3244  e.append(m2_expr.ExprAff(a[64:96], m2_expr.ExprOp('int_32_to_float', b[64:96])))
3245  e.append(m2_expr.ExprAff(a[96:128], m2_expr.ExprOp('int_32_to_float', b[96:128])))
3246  return e, []
def miasm2.arch.x86.sem.cvtpd2dq (   ir,
  instr,
  a,
  b 
)

Definition at line 3247 of file sem.py.

3248 def cvtpd2dq(ir, instr, a, b):
3249  e = []
3250  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('double_to_int_32', b[:64])))
3251  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('double_to_int_32', b[64:128])))
3252  e.append(m2_expr.ExprAff(a[64:128], m2_expr.ExprInt64(0)))
3253  return e, []
def miasm2.arch.x86.sem.cvtpd2pi (   ir,
  instr,
  a,
  b 
)

Definition at line 3254 of file sem.py.

3255 def cvtpd2pi(ir, instr, a, b):
3256  e = []
3257  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('double_to_int_32', b[:64])))
3258  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('double_to_int_32', b[64:128])))
3259  return e, []
def miasm2.arch.x86.sem.cvtpd2ps (   ir,
  instr,
  a,
  b 
)

Definition at line 3260 of file sem.py.

3261 def cvtpd2ps(ir, instr, a, b):
3262  e = []
3263  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('double_to_float', b[:64])))
3264  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('double_to_float', b[64:128])))
3265  e.append(m2_expr.ExprAff(a[64:128], m2_expr.ExprInt64(0)))
3266  return e, []
def miasm2.arch.x86.sem.cvtpi2pd (   ir,
  instr,
  a,
  b 
)

Definition at line 3267 of file sem.py.

3268 def cvtpi2pd(ir, instr, a, b):
3269  e = []
3270  e.append(m2_expr.ExprAff(a[:64], m2_expr.ExprOp('int_32_to_double', b[:32])))
3271  e.append(m2_expr.ExprAff(a[64:128], m2_expr.ExprOp('int_32_to_double', b[32:64])))
3272  return e, []
def miasm2.arch.x86.sem.cvtpi2ps (   ir,
  instr,
  a,
  b 
)

Definition at line 3273 of file sem.py.

3274 def cvtpi2ps(ir, instr, a, b):
3275  e = []
3276  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('int_32_to_float', b[:32])))
3277  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('int_32_to_float', b[32:64])))
3278  return e, []
def miasm2.arch.x86.sem.cvtps2dq (   ir,
  instr,
  a,
  b 
)

Definition at line 3279 of file sem.py.

3280 def cvtps2dq(ir, instr, a, b):
3281  e = []
3282  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('float_to_int_32', b[:32])))
3283  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('float_to_int_32', b[32:64])))
3284  e.append(m2_expr.ExprAff(a[64:96], m2_expr.ExprOp('float_to_int_32', b[64:96])))
3285  e.append(m2_expr.ExprAff(a[96:128], m2_expr.ExprOp('float_to_int_32', b[96:128])))
3286  return e, []
def miasm2.arch.x86.sem.cvtps2pd (   ir,
  instr,
  a,
  b 
)

Definition at line 3287 of file sem.py.

3288 def cvtps2pd(ir, instr, a, b):
3289  e = []
3290  e.append(m2_expr.ExprAff(a[:64], m2_expr.ExprOp('float_to_double', b[:32])))
3291  e.append(m2_expr.ExprAff(a[64:128], m2_expr.ExprOp('float_to_double', b[32:64])))
3292  return e, []
def miasm2.arch.x86.sem.cvtps2pi (   ir,
  instr,
  a,
  b 
)

Definition at line 3293 of file sem.py.

3294 def cvtps2pi(ir, instr, a, b):
3295  e = []
3296  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('float_to_int_32', b[:32])))
3297  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('float_to_int_32', b[32:64])))
3298  return e, []
def miasm2.arch.x86.sem.cvtsd2si (   ir,
  instr,
  a,
  b 
)

Definition at line 3299 of file sem.py.

3300 def cvtsd2si(ir, instr, a, b):
3301  e = []
3302  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('double_to_int_32', b[:64])))
3303  return e, []
def miasm2.arch.x86.sem.cvtsd2ss (   ir,
  instr,
  a,
  b 
)

Definition at line 3304 of file sem.py.

3305 def cvtsd2ss(ir, instr, a, b):
3306  e = []
3307  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('double_to_float', b[:64])))
3308  return e, []
def miasm2.arch.x86.sem.cvtsi2sd (   ir,
  instr,
  a,
  b 
)

Definition at line 3309 of file sem.py.

3310 def cvtsi2sd(ir, instr, a, b):
3311  e = []
3312  e.append(m2_expr.ExprAff(a[:64], m2_expr.ExprOp('int_32_to_double', b[:32])))
3313  return e, []
def miasm2.arch.x86.sem.cvtsi2ss (   ir,
  instr,
  a,
  b 
)

Definition at line 3314 of file sem.py.

3315 def cvtsi2ss(ir, instr, a, b):
3316  e = []
3317  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('int_32_to_float', b[:32])))
3318  return e, []
def miasm2.arch.x86.sem.cvtss2sd (   ir,
  instr,
  a,
  b 
)

Definition at line 3319 of file sem.py.

3320 def cvtss2sd(ir, instr, a, b):
3321  e = []
3322  e.append(m2_expr.ExprAff(a[:64], m2_expr.ExprOp('float_to_double', b[:32])))
3323  return e, []
def miasm2.arch.x86.sem.cvtss2si (   ir,
  instr,
  a,
  b 
)

Definition at line 3324 of file sem.py.

3325 def cvtss2si(ir, instr, a, b):
3326  e = []
3327  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('float_to_int_32', b[:32])))
3328  return e, []
def miasm2.arch.x86.sem.cvttpd2dq (   ir,
  instr,
  a,
  b 
)

Definition at line 3335 of file sem.py.

3336 def cvttpd2dq(ir, instr, a, b):
3337  e = []
3338  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('double_trunc_to_int_32', b[:64])))
3339  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('double_trunc_to_int_32', b[64:128])))
3340  e.append(m2_expr.ExprAff(a[64:128], m2_expr.ExprInt64(0)))
3341  return e, []
def miasm2.arch.x86.sem.cvttpd2pi (   ir,
  instr,
  a,
  b 
)

Definition at line 3329 of file sem.py.

3330 def cvttpd2pi(ir, instr, a, b):
3331  e = []
3332  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('double_trunc_to_int_32', b[:64])))
3333  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('double_trunc_to_int_32', b[64:128])))
3334  return e, []
def miasm2.arch.x86.sem.cvttps2dq (   ir,
  instr,
  a,
  b 
)

Definition at line 3342 of file sem.py.

3343 def cvttps2dq(ir, instr, a, b):
3344  e = []
3345  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('float_trunc_to_int_32', b[:32])))
3346  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('float_trunc_to_int_32', b[32:64])))
3347  e.append(m2_expr.ExprAff(a[64:96], m2_expr.ExprOp('float_trunc_to_int_32', b[64:96])))
3348  e.append(m2_expr.ExprAff(a[96:128], m2_expr.ExprOp('float_trunc_to_int_32', b[96:128])))
3349  return e, []
def miasm2.arch.x86.sem.cvttps2pi (   ir,
  instr,
  a,
  b 
)

Definition at line 3350 of file sem.py.

3351 def cvttps2pi(ir, instr, a, b):
3352  e = []
3353  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('float_trunc_to_int_32', b[:32])))
3354  e.append(m2_expr.ExprAff(a[32:64], m2_expr.ExprOp('float_trunc_to_int_32', b[32:64])))
3355  return e, []
def miasm2.arch.x86.sem.cvttsd2si (   ir,
  instr,
  a,
  b 
)

Definition at line 3356 of file sem.py.

3357 def cvttsd2si(ir, instr, a, b):
3358  e = []
3359  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('double_trunc_to_int_32', b[:64])))
3360  return e, []
def miasm2.arch.x86.sem.cvttss2si (   ir,
  instr,
  a,
  b 
)

Definition at line 3361 of file sem.py.

3362 def cvttss2si(ir, instr, a, b):
3363  e = []
3364  e.append(m2_expr.ExprAff(a[:32], m2_expr.ExprOp('float_trunc_to_int_32', b[:32])))
3365  return e, []
def miasm2.arch.x86.sem.cwd (   ir,
  instr 
)

Definition at line 1575 of file sem.py.

1576 def cwd(ir, instr):
1577  e = []
1578  tempAX = mRAX[instr.mode][:16]
1579  tempDX = mRDX[instr.mode][:16]
1580  c = tempAX.signExtend(32)
1581  e.append(m2_expr.ExprAff(tempAX, c[:16]))
1582  e.append(m2_expr.ExprAff(tempDX, c[16:32]))
1583  return e, []
1584 
def miasm2.arch.x86.sem.cwde (   ir,
  instr 
)

Definition at line 1559 of file sem.py.

1560 def cwde(ir, instr):
1561  e = []
1562  tempAX = mRAX[instr.mode][:16]
1563  tempEAX = mRAX[instr.mode][:32]
1564  e.append(m2_expr.ExprAff(tempEAX, tempAX.signExtend(32)))
1565  return e, []
1566 
def miasm2.arch.x86.sem.daa (   ir,
  instr 
)

Definition at line 2506 of file sem.py.

2507 def daa(ir, instr):
2508  e = []
2509  r_al = mRAX[instr.mode][:8]
2510 
2511  cond1 = expr_cmpu(r_al[:4], m2_expr.ExprInt(0x9, 4)) | af
2512  e.append(m2_expr.ExprAff(af, cond1))
2513 
2514 
2515  cond2 = expr_cmpu(m2_expr.ExprInt8(6), r_al)
2516  cond3 = expr_cmpu(r_al, m2_expr.ExprInt8(0x99)) | cf
2517 
2518 
2519  cf_c1 = m2_expr.ExprCond(cond1,
2520  cf | (cond2),
2521  m2_expr.ExprInt1(0))
2522  new_cf = m2_expr.ExprCond(cond3,
2523  m2_expr.ExprInt1(1),
2524  m2_expr.ExprInt1(0))
2525  e.append(m2_expr.ExprAff(cf, new_cf))
2526 
2527  al_c1 = m2_expr.ExprCond(cond1,
2528  r_al + m2_expr.ExprInt8(6),
2529  r_al)
2530 
2531  new_al = m2_expr.ExprCond(cond3,
2532  al_c1 + m2_expr.ExprInt8(0x60),
2533  al_c1)
2534  e.append(m2_expr.ExprAff(r_al, new_al))
2535  return e, []

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.das (   ir,
  instr 
)

Definition at line 2536 of file sem.py.

2537 def das(ir, instr):
2538  e = []
2539  r_al = mRAX[instr.mode][:8]
2540 
2541  cond1 = expr_cmpu(r_al[:4], m2_expr.ExprInt(0x9, 4)) | af
2542  e.append(m2_expr.ExprAff(af, cond1))
2543 
2544 
2545  cond2 = expr_cmpu(m2_expr.ExprInt8(6), r_al)
2546  cond3 = expr_cmpu(r_al, m2_expr.ExprInt8(0x99)) | cf
2547 
2548 
2549  cf_c1 = m2_expr.ExprCond(cond1,
2550  cf | (cond2),
2551  m2_expr.ExprInt1(0))
2552  new_cf = m2_expr.ExprCond(cond3,
2553  m2_expr.ExprInt1(1),
2554  cf_c1)
2555  e.append(m2_expr.ExprAff(cf, new_cf))
2556 
2557  al_c1 = m2_expr.ExprCond(cond1,
2558  r_al - m2_expr.ExprInt8(6),
2559  r_al)
2560 
2561  new_al = m2_expr.ExprCond(cond3,
2562  al_c1 - m2_expr.ExprInt8(0x60),
2563  al_c1)
2564  e.append(m2_expr.ExprAff(r_al, new_al))
2565  return e, []
2566 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.dec (   ir,
  instr,
  a 
)

Definition at line 682 of file sem.py.

683 def dec(ir, instr, a):
684  e = []
685  b = m2_expr.ExprInt_from(a, -1)
686  c = a + b
687  e += update_flag_arith(c)
688  e += update_flag_af(c)
689 
690  e.append(update_flag_add_of(a, b, c))
691  e.append(m2_expr.ExprAff(a, c))
692  return e, []
693 
def update_flag_arith
Definition: sem.py:99
def update_flag_add_of
Definition: sem.py:124
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.div (   ir,
  instr,
  a 
)

Definition at line 1422 of file sem.py.

1423 def div(ir, instr, a):
1424  e = []
1425  size = a.size
1426  if size == 8:
1427  b = mRAX[instr.mode][:16]
1428  elif size in [16, 32, 64]:
1429  s1, s2 = mRDX[size], mRAX[size]
1430  b = m2_expr.ExprCompose([(s2, 0, size),
1431  (s1, size, size*2)])
1432  else:
1433  raise ValueError('div arg not impl', a)
1434 
1435  c_d = m2_expr.ExprOp('udiv', b, a.zeroExtend(b.size))
1436  c_r = m2_expr.ExprOp('umod', b, a.zeroExtend(b.size))
1437 
1438  # if 8 bit div, only ax is affected
1439  if size == 8:
1440  e.append(m2_expr.ExprAff(b, m2_expr.ExprCompose([(c_d[:8], 0, 8),
1441  (c_r[:8], 8, 16)])))
1442  else:
1443  e.append(m2_expr.ExprAff(s1, c_r[:size]))
1444  e.append(m2_expr.ExprAff(s2, c_d[:size]))
1445  return e, []
1446 
1447 # XXX size to do; eflag
1448 
def miasm2.arch.x86.sem.enter (   ir,
  instr,
  a,
  b 
)

Definition at line 1234 of file sem.py.

1235 def enter(ir, instr, a, b):
1236  opmode, admode = instr.v_opmode(), instr.v_admode()
1237  s = opmode
1238  myesp = mRSP[instr.mode][:s]
1239  myebp = mRBP[instr.mode][:s]
1240 
1241  a = a.zeroExtend(s)
1242 
1243  e = []
1244  esp_tmp = myesp - m2_expr.ExprInt(s / 8, s)
1245  e.append(m2_expr.ExprAff(m2_expr.ExprMem(esp_tmp,
1246  size=s),
1247  myebp))
1248  e.append(m2_expr.ExprAff(myebp, esp_tmp))
1249  e.append(m2_expr.ExprAff(myesp,
1250  myesp - (a + m2_expr.ExprInt(s / 8, s))))
1251  return e, []
1252 
def miasm2.arch.x86.sem.f2xm1 (   ir,
  instr 
)

Definition at line 2400 of file sem.py.

2401 def f2xm1(ir, instr):
2402  e = []
2403  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('f2xm1', float_st0)))
2404  e += set_float_cs_eip(instr)
2405  return e, []
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fabs (   ir,
  instr 
)

Definition at line 2420 of file sem.py.

2421 def fabs(ir, instr):
2422  e = []
2423  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fabs', float_st0)))
2424  e += set_float_cs_eip(instr)
2425  return e, []
2426 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fadd (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2079 of file sem.py.

2080 def fadd(ir, instr, a, b=None):
2081  a, b = float_implicit_st0(a, b)
2082  e = []
2083  src = mem2double(b)
2084  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fadd', a, src)))
2085 
2086  e += set_float_cs_eip(instr)
2087  return e, []
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.faddp (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2138 of file sem.py.

2139 def faddp(ir, instr, a, b=None):
2140  a, b = float_implicit_st0(a, b)
2141  e = []
2142  src = mem2double(b)
2143  e.append(m2_expr.ExprAff(float_prev(a), m2_expr.ExprOp('fadd', a, src)))
2144  e += set_float_cs_eip(instr)
2145  e += float_pop(a)
2146  return e, []
2147 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fchs (   ir,
  instr 
)

Definition at line 2406 of file sem.py.

2407 def fchs(ir, instr):
2408  e = []
2409  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fchs', float_st0)))
2410  e += set_float_cs_eip(instr)
2411  return e, []
2412 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fclex (   ir,
  instr 
)

Definition at line 3028 of file sem.py.

3029 def fclex(ir, instr):
3030  # XXX TODO
3031  return [], None
3032 
def miasm2.arch.x86.sem.fcmovb (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2455 of file sem.py.

2456 def fcmovb(ir, instr, arg1, arg2):
2457  return gen_fcmov(ir, instr, cf, arg1, arg2, True)
2458 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fcmovbe (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2463 of file sem.py.

2464 def fcmovbe(ir, instr, arg1, arg2):
2465  return gen_fcmov(ir, instr, cf|zf, arg1, arg2, True)
2466 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fcmove (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2459 of file sem.py.

2460 def fcmove(ir, instr, arg1, arg2):
2461  return gen_fcmov(ir, instr, zf, arg1, arg2, True)
2462 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fcmovnb (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2471 of file sem.py.

2472 def fcmovnb(ir, instr, arg1, arg2):
2473  return gen_fcmov(ir, instr, cf, arg1, arg2, False)
2474 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fcmovnbe (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2479 of file sem.py.

2480 def fcmovnbe(ir, instr, arg1, arg2):
2481  return gen_fcmov(ir, instr, cf|zf, arg1, arg2, False)
2482 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fcmovne (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2475 of file sem.py.

2476 def fcmovne(ir, instr, arg1, arg2):
2477  return gen_fcmov(ir, instr, zf, arg1, arg2, False)
2478 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fcmovnu (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2483 of file sem.py.

2484 def fcmovnu(ir, instr, arg1, arg2):
2485  return gen_fcmov(ir, instr, pf, arg1, arg2, False)
2486 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fcmovu (   ir,
  instr,
  arg1,
  arg2 
)

Definition at line 2467 of file sem.py.

2468 def fcmovu(ir, instr, arg1, arg2):
2469  return gen_fcmov(ir, instr, pf, arg1, arg2, True)
2470 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fcom (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1767 of file sem.py.

1768 def fcom(ir, instr, a=None, b=None):
1769 
1770  if a is None and b is None:
1771  a, b = float_st0, float_st1
1772  elif b is None:
1773  b = a
1774  a = float_st0
1775 
1776  e = []
1777  b = mem2double(b)
1778 
1779  e.append(m2_expr.ExprAff(float_c0, m2_expr.ExprOp('fcom_c0', a, b)))
1780  e.append(m2_expr.ExprAff(float_c1, m2_expr.ExprOp('fcom_c1', a, b)))
1781  e.append(m2_expr.ExprAff(float_c2, m2_expr.ExprOp('fcom_c2', a, b)))
1782  e.append(m2_expr.ExprAff(float_c3, m2_expr.ExprOp('fcom_c3', a, b)))
1783 
1784  e += set_float_cs_eip(instr)
1785  return e, []
1786 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.fcomi (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1837 of file sem.py.

1838 def fcomi(ir, instr, a=None, b=None):
1839  # TODO unordered float
1840  if a is None and b is None:
1841  a, b = float_st0, float_st1
1842  elif b is None:
1843  b = a
1844  a = float_st0
1845 
1846  e = []
1847 
1848  e.append(m2_expr.ExprAff(cf, m2_expr.ExprOp('fcom_c0', a, b)))
1849  e.append(m2_expr.ExprAff(pf, m2_expr.ExprOp('fcom_c2', a, b)))
1850  e.append(m2_expr.ExprAff(zf, m2_expr.ExprOp('fcom_c3', a, b)))
1851 
1852  e.append(m2_expr.ExprAff(of, m2_expr.ExprInt1(0)))
1853  e.append(m2_expr.ExprAff(nf, m2_expr.ExprInt1(0)))
1854  e.append(m2_expr.ExprAff(af, m2_expr.ExprInt1(0)))
1855 
1856  e += set_float_cs_eip(instr)
1857  return e, []
1858 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.fcomip (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1859 of file sem.py.

1860 def fcomip(ir, instr, a=None, b=None):
1861  e, extra = fcomi(ir, instr, a, b)
1862  e += float_pop()
1863  e += set_float_cs_eip(instr)
1864  return e, extra
1865 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.fcomp (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1875 of file sem.py.

1876 def fcomp(ir, instr, a=None, b=None):
1877  e, extra = fcom(ir, instr, a, b)
1878  e += float_pop()
1879  e += set_float_cs_eip(instr)
1880  return e, extra
1881 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.fcompp (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1882 of file sem.py.

1883 def fcompp(ir, instr, a=None, b=None):
1884  e, extra = fcom(ir, instr, a, b)
1885  e += float_pop(popcount=2)
1886  e += set_float_cs_eip(instr)
1887  return e, extra
1888 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.fcos (   ir,
  instr 
)

Definition at line 2369 of file sem.py.

2370 def fcos(ir, instr):
2371  e = []
2372  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fcos', float_st0)))
2373  e += set_float_cs_eip(instr)
2374  return e, []
2375 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fdiv (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2253 of file sem.py.

2254 def fdiv(ir, instr, a, b=None):
2255  a, b = float_implicit_st0(a, b)
2256  e = []
2257  src = mem2double(b)
2258  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fdiv', a, src)))
2259  e += set_float_cs_eip(instr)
2260  return e, []
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fdivp (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2298 of file sem.py.

2299 def fdivp(ir, instr, a, b=None):
2300  # Invalid emulation
2301  a, b = float_implicit_st0(a, b)
2302  e = []
2303  src = mem2double(b)
2304  e.append(m2_expr.ExprAff(float_prev(a), m2_expr.ExprOp('fdiv', a, src)))
2305  e += set_float_cs_eip(instr)
2306  e += float_pop(a)
2307  return e, []
2308 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fdivr (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2261 of file sem.py.

2262 def fdivr(ir, instr, a, b=None):
2263  a, b = float_implicit_st0(a, b)
2264  e = []
2265  src = mem2double(b)
2266  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fdiv', src, a)))
2267  e += set_float_cs_eip(instr)
2268  return e, []
2269 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fdivrp (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2270 of file sem.py.

2271 def fdivrp(ir, instr, a, b=None):
2272  a, b = float_implicit_st0(a, b)
2273  e = []
2274  src = mem2double(b)
2275  e.append(m2_expr.ExprAff(float_prev(a), m2_expr.ExprOp('fdiv', src, a)))
2276  e += set_float_cs_eip(instr)
2277  e += float_pop(a)
2278  return e, []
2279 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fiadd (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2088 of file sem.py.

2089 def fiadd(ir, instr, a, b=None):
2090  a, b = float_implicit_st0(a, b)
2091  e = []
2092  src = mem2double(b)
2093  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fiadd', a, src)))
2094  e += set_float_cs_eip(instr)
2095  return e, []
2096 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.ficom (   ir,
  instr,
  a,
  b = None 
)

Definition at line 1813 of file sem.py.

1814 def ficom(ir, instr, a, b = None):
1815 
1816  a, b = float_implicit_st0(a, b)
1817 
1818  e = []
1819 
1820  e.append(m2_expr.ExprAff(float_c0,
1821  m2_expr.ExprOp('fcom_c0', a,
1822  b.zeroExtend(a.size))))
1823  e.append(m2_expr.ExprAff(float_c1,
1824  m2_expr.ExprOp('fcom_c1', a,
1825  b.zeroExtend(a.size))))
1826  e.append(m2_expr.ExprAff(float_c2,
1827  m2_expr.ExprOp('fcom_c2', a,
1828  b.zeroExtend(a.size))))
1829  e.append(m2_expr.ExprAff(float_c3,
1830  m2_expr.ExprOp('fcom_c3', a,
1831  b.zeroExtend(a.size))))
1832 
1833  e += set_float_cs_eip(instr)
1834  return e, []
1835 
1836 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.ficomp (   ir,
  instr,
  a,
  b = None 
)

Definition at line 1889 of file sem.py.

1890 def ficomp(ir, instr, a, b = None):
1891  e, extra = ficom(ir, instr, a, b)
1892  e += float_pop()
1893  e += set_float_cs_eip(instr)
1894  return e, extra
1895 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fidiv (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2280 of file sem.py.

2281 def fidiv(ir, instr, a, b=None):
2282  a, b = float_implicit_st0(a, b)
2283  e = []
2284  src = mem2double(b)
2285  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fidiv', a, src)))
2286  e += set_float_cs_eip(instr)
2287  return e, []
2288 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fidivr (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2289 of file sem.py.

2290 def fidivr(ir, instr, a, b=None):
2291  a, b = float_implicit_st0(a, b)
2292  e = []
2293  src = mem2double(b)
2294  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fidiv', src, a)))
2295  e += set_float_cs_eip(instr)
2296  return e, []
2297 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fild (   ir,
  instr,
  a 
)

Definition at line 2024 of file sem.py.

2025 def fild(ir, instr, a):
2026  # XXXXX
2027  src = m2_expr.ExprOp('int_%.2d_to_double' % a.size, a)
2028  e = []
2029  e += set_float_cs_eip(instr)
2030  e_fld, extra = fld(ir, instr, src)
2031  e += e_fld
2032  return e, extra
2033 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fimul (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2244 of file sem.py.

2245 def fimul(ir, instr, a, b=None):
2246  a, b = float_implicit_st0(a, b)
2247  e = []
2248  src = mem2double(b)
2249  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fimul', a, src)))
2250  e += set_float_cs_eip(instr)
2251  return e, []
2252 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fist (   ir,
  instr,
  a 
)

Definition at line 1992 of file sem.py.

1993 def fist(ir, instr, a):
1994  e = []
1995  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('double_to_int_%d' % a.size,
1996  float_st0)))
1997 
1998  e += set_float_cs_eip(instr)
1999  return e, []
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.fistp (   ir,
  instr,
  a 
)

Definition at line 2000 of file sem.py.

2001 def fistp(ir, instr, a):
2002  e, extra = fist(ir, instr, a)
2003  e += float_pop(a)
2004  return e, extra

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fisttp (   ir,
  instr,
  a 
)

Definition at line 2013 of file sem.py.

2014 def fisttp(ir, instr, a):
2015  e = []
2016  e.append(m2_expr.ExprAff(a,
2017  m2_expr.ExprOp('double_trunc_to_int_%d' % a.size,
2018  float_st0)))
2019 
2020  e += set_float_cs_eip(instr)
2021  e += float_pop(a)
2022  return e, []
2023 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fisub (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2097 of file sem.py.

2098 def fisub(ir, instr, a, b=None):
2099  a, b = float_implicit_st0(a, b)
2100  e = []
2101  src = mem2double(b)
2102  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fisub', a, src)))
2103  e += set_float_cs_eip(instr)
2104  return e, []
2105 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fisubr (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2106 of file sem.py.

2107 def fisubr(ir, instr, a, b=None):
2108  a, b = float_implicit_st0(a, b)
2109  e = []
2110  src = mem2double(b)
2111  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fisub', src, a)))
2112  e += set_float_cs_eip(instr)
2113  return e, []
2114 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fld (   ir,
  instr,
  a 
)

Definition at line 1951 of file sem.py.

1952 def fld(ir, instr, a):
1953  src = mem2double(a)
1954 
1955  e = []
1956  e.append(m2_expr.ExprAff(float_st7, float_st6))
1957  e.append(m2_expr.ExprAff(float_st6, float_st5))
1958  e.append(m2_expr.ExprAff(float_st5, float_st4))
1959  e.append(m2_expr.ExprAff(float_st4, float_st3))
1960  e.append(m2_expr.ExprAff(float_st3, float_st2))
1961  e.append(m2_expr.ExprAff(float_st2, float_st1))
1962  e.append(m2_expr.ExprAff(float_st1, float_st0))
1963  e.append(m2_expr.ExprAff(float_st0, src))
1964  e.append(
1965  m2_expr.ExprAff(float_stack_ptr,
1966  float_stack_ptr + m2_expr.ExprInt(1, 3)))
1967 
1968  e += set_float_cs_eip(instr)
1969  return e, []
1970 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.fld1 (   ir,
  instr 
)

Definition at line 2039 of file sem.py.

2040 def fld1(ir, instr):
2041  return fld(ir, instr, m2_expr.ExprOp('int_32_to_double',
2042  m2_expr.ExprInt32(1)))
2043 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fldcw (   ir,
  instr,
  a 
)

Definition at line 2445 of file sem.py.

2446 def fldcw(ir, instr, a):
2447  e = []
2448  e.append(m2_expr.ExprAff(float_control, a))
2449  return e, []
2450 
def miasm2.arch.x86.sem.fldl2e (   ir,
  instr 
)

Definition at line 2065 of file sem.py.

2066 def fldl2e(ir, instr):
2067  x = struct.pack('d', 1 / math.log(2))
2068  x = struct.unpack('Q', x)[0]
2069  return fld(ir, instr, m2_expr.ExprOp('mem_64_to_double',
2070  m2_expr.ExprInt64(x)))
2071 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fldl2t (   ir,
  instr 
)

Definition at line 2044 of file sem.py.

2045 def fldl2t(ir, instr):
2046  value_f = math.log(10)/math.log(2)
2047  value = struct.unpack('I', struct.pack('f', value_f))[0]
2048  return fld(ir, instr, m2_expr.ExprOp('int_32_to_double',
2049  m2_expr.ExprInt32(value)))
2050 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fldlg2 (   ir,
  instr 
)

Definition at line 2072 of file sem.py.

2073 def fldlg2(ir, instr):
2074  x = struct.pack('d', math.log10(2))
2075  x = struct.unpack('Q', x)[0]
2076  return fld(ir, instr, m2_expr.ExprOp('mem_64_to_double',
2077  m2_expr.ExprInt64(x)))
2078 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fldln2 (   ir,
  instr 
)

Definition at line 2058 of file sem.py.

2059 def fldln2(ir, instr):
2060  value_f = math.log(2)
2061  value = struct.unpack('I', struct.pack('f', value_f))[0]
2062  return fld(ir, instr, m2_expr.ExprOp('int_32_to_double',
2063  m2_expr.ExprInt32(value)))
2064 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fldpi (   ir,
  instr 
)

Definition at line 2051 of file sem.py.

2052 def fldpi(ir, instr):
2053  value_f = math.pi
2054  value = struct.unpack('I', struct.pack('f', value_f))[0]
2055  return fld(ir, instr, m2_expr.ExprOp('int_32_to_double',
2056  m2_expr.ExprInt32(value)))
2057 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fldz (   ir,
  instr 
)

Definition at line 2034 of file sem.py.

2035 def fldz(ir, instr):
2036  return fld(ir, instr, m2_expr.ExprOp('int_32_to_double',
2037  m2_expr.ExprInt32(0)))
2038 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.float_implicit_st0 (   arg1,
  arg2 
)
Generate full float operators if one argument is implicit (float_st0)

Definition at line 179 of file sem.py.

180 def float_implicit_st0(arg1, arg2):
181  """
182  Generate full float operators if one argument is implicit (float_st0)
183  """
184  if arg2 is None:
185  arg2 = arg1
186  arg1 = float_st0
187  return arg1, arg2
188 
def float_implicit_st0
Definition: sem.py:179

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.float_pop (   avoid_flt = None,
  popcount = 1 
)
Generate floatpop semantic (@popcount times), avoiding the avoid_flt@ float
@avoid_flt: float avoided in the generated semantic
@popcount: pop count

Definition at line 1744 of file sem.py.

1745 def float_pop(avoid_flt=None, popcount=1):
1746  """
1747  Generate floatpop semantic (@popcount times), avoiding the avoid_flt@ float
1748  @avoid_flt: float avoided in the generated semantic
1749  @popcount: pop count
1750  """
1751  avoid_flt = float_prev(avoid_flt, popcount)
1752  e = []
1753  for i in xrange(8-popcount):
1754  if avoid_flt != float_list[i]:
1755  e.append(m2_expr.ExprAff(float_list[i],
1756  float_list[i+popcount]))
1757  for i in xrange(8-popcount, 8):
1758  e.append(m2_expr.ExprAff(float_list[i],
1759  m2_expr.ExprInt_from(float_list[i], 0)))
1760  e.append(
1761  m2_expr.ExprAff(float_stack_ptr,
1762  float_stack_ptr - m2_expr.ExprInt(popcount, 3)))
1763  return e
1764 
1765 # XXX TODO
1766 

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.float_prev (   flt,
  popcount = 1 
)

Definition at line 1734 of file sem.py.

1735 def float_prev(flt, popcount=1):
1736  if not flt in float_list:
1737  return None
1738  i = float_list.index(flt)
1739  if i < popcount:
1740  raise ValueError('broken index')
1741  flt = float_list[i - popcount]
1742  return flt
1743 

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.float_vec_vertical_instr (   op,
  elt_size 
)

Definition at line 3164 of file sem.py.

3165 def float_vec_vertical_instr(op, elt_size):
3166  return __vec_vertical_instr_gen(op, elt_size, float_vec_vertical_sem)
def float_vec_vertical_instr
Definition: sem.py:3164
def __vec_vertical_instr_gen
Definition: sem.py:3151

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.float_vec_vertical_sem (   op,
  elt_size,
  reg_size,
  a,
  b 
)

Definition at line 3131 of file sem.py.

3132 def float_vec_vertical_sem(op, elt_size, reg_size, a, b):
3133  assert(reg_size % elt_size == 0)
3134  n = reg_size/elt_size
3135 
3136  x_to_int, int_to_x = {32: ('float_to_int_%d', 'int_%d_to_float'),
3137  64: ('double_to_int_%d', 'int_%d_to_double')}[elt_size]
3138  if op == '-':
3139  ops = [(m2_expr.ExprOp(x_to_int % elt_size,
3140  m2_expr.ExprOp(int_to_x % elt_size, a[i*elt_size:(i+1)*elt_size]) -
3141  m2_expr.ExprOp(int_to_x % elt_size, b[i*elt_size:(i+1)*elt_size])),
3142  i*elt_size, (i+1)*elt_size) for i in xrange(0, n)]
3143  else:
3144  ops = [(m2_expr.ExprOp(x_to_int % elt_size,
3145  m2_expr.ExprOp(op,
3146  m2_expr.ExprOp(int_to_x % elt_size, a[i*elt_size:(i+1)*elt_size]),
3147  m2_expr.ExprOp(int_to_x % elt_size, b[i*elt_size:(i+1)*elt_size]))),
3148  i*elt_size, (i+1)*elt_size) for i in xrange(0, n)]
3149 
3150  return m2_expr.ExprCompose(ops)
def float_vec_vertical_sem
Definition: sem.py:3131
def miasm2.arch.x86.sem.fmul (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2236 of file sem.py.

2237 def fmul(ir, instr, a, b=None):
2238  a, b = float_implicit_st0(a, b)
2239  e = []
2240  src = mem2double(b)
2241  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fmul', a, src)))
2242  e += set_float_cs_eip(instr)
2243  return e, []
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fmulp (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2309 of file sem.py.

2310 def fmulp(ir, instr, a, b=None):
2311  # Invalid emulation
2312  a, b = float_implicit_st0(a, b)
2313  e = []
2314  src = mem2double(b)
2315  e.append(m2_expr.ExprAff(float_prev(a), m2_expr.ExprOp('fmul', a, src)))
2316  e += set_float_cs_eip(instr)
2317  e += float_pop(a)
2318  return e, []
2319 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fnclex (   ir,
  instr 
)

Definition at line 3033 of file sem.py.

3034 def fnclex(ir, instr):
3035  # XXX TODO
3036  return [], None
3037 
def miasm2.arch.x86.sem.fninit (   ir,
  instr 
)

Definition at line 2148 of file sem.py.

2149 def fninit(ir, instr):
2150  e = []
2151  e += set_float_cs_eip(instr)
2152  return e, []
2153 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fnstcw (   ir,
  instr,
  a 
)

Definition at line 2439 of file sem.py.

2440 def fnstcw(ir, instr, a):
2441  e = []
2442  e.append(m2_expr.ExprAff(a, float_control))
2443  return e, []
2444 
def miasm2.arch.x86.sem.fnstenv (   ir,
  instr,
  a 
)

Definition at line 2163 of file sem.py.

2164 def fnstenv(ir, instr, a):
2165  e = []
2166  # XXX TODO tag word, ...
2167  status_word = m2_expr.ExprCompose([(m2_expr.ExprInt8(0), 0, 8),
2168  (float_c0, 8, 9),
2169  (float_c1, 9, 10),
2170  (float_c2, 10, 11),
2171  (float_stack_ptr, 11, 14),
2172  (float_c3, 14, 15),
2173  (m2_expr.ExprInt1(0), 15, 16),
2174  ])
2175 
2176  s = instr.mode
2177  # The behaviour in 64bit is identical to 64 bit
2178  # This will truncate addresses
2179  s = min(32, s)
2180  ad = m2_expr.ExprMem(a.arg, size=16)
2181  e.append(m2_expr.ExprAff(ad, float_control))
2182  ad = m2_expr.ExprMem(a.arg + m2_expr.ExprInt_from(a.arg, s / 8 * 1),
2183  size=16)
2184  e.append(m2_expr.ExprAff(ad, status_word))
2185  ad = m2_expr.ExprMem(a.arg + m2_expr.ExprInt_from(a.arg, s / 8 * 3),
2186  size=s)
2187  e.append(m2_expr.ExprAff(ad, float_eip[:s]))
2188  ad = m2_expr.ExprMem(a.arg + m2_expr.ExprInt_from(a.arg, s / 8 * 4),
2189  size=16)
2190  e.append(m2_expr.ExprAff(ad, float_cs))
2191  ad = m2_expr.ExprMem(a.arg + m2_expr.ExprInt_from(a.arg, s / 8 * 5),
2192  size=s)
2193  e.append(m2_expr.ExprAff(ad, float_address[:s]))
2194  ad = m2_expr.ExprMem(a.arg + m2_expr.ExprInt_from(a.arg, s / 8 * 6),
2195  size=16)
2196  e.append(m2_expr.ExprAff(ad, float_ds))
2197  return e, []
2198 
def miasm2.arch.x86.sem.fnstsw (   ir,
  instr,
  dst 
)

Definition at line 2427 of file sem.py.

2428 def fnstsw(ir, instr, dst):
2429  args = [(m2_expr.ExprInt8(0), 0, 8),
2430  (float_c0, 8, 9),
2431  (float_c1, 9, 10),
2432  (float_c2, 10, 11),
2433  (float_stack_ptr, 11, 14),
2434  (float_c3, 14, 15),
2435  (m2_expr.ExprInt1(0), 15, 16)]
2436  e = [m2_expr.ExprAff(dst, m2_expr.ExprCompose(args))]
2437  return e, []
2438 
def miasm2.arch.x86.sem.fpatan (   ir,
  instr 
)

Definition at line 2115 of file sem.py.

2116 def fpatan(ir, instr):
2117  e = []
2118  a = float_st1
2119  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fpatan', float_st0, float_st1)))
2120  e += set_float_cs_eip(instr)
2121  e += float_pop(a)
2122  return e, []
2123 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fprem (   ir,
  instr 
)

Definition at line 2124 of file sem.py.

2125 def fprem(ir, instr):
2126  e = []
2127  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fprem', float_st0, float_st1)))
2128  e += set_float_cs_eip(instr)
2129  return e, []
2130 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fprem1 (   ir,
  instr 
)

Definition at line 2131 of file sem.py.

2132 def fprem1(ir, instr):
2133  e = []
2134  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fprem1', float_st0, float_st1)))
2135  e += set_float_cs_eip(instr)
2136  return e, []
2137 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fptan (   ir,
  instr 
)

Definition at line 2337 of file sem.py.

2338 def fptan(ir, instr):
2339  e = []
2340  e.append(m2_expr.ExprAff(float_st7, float_st6))
2341  e.append(m2_expr.ExprAff(float_st6, float_st5))
2342  e.append(m2_expr.ExprAff(float_st5, float_st4))
2343  e.append(m2_expr.ExprAff(float_st4, float_st3))
2344  e.append(m2_expr.ExprAff(float_st3, float_st2))
2345  e.append(m2_expr.ExprAff(float_st2, float_st1))
2346  e.append(m2_expr.ExprAff(float_st1, m2_expr.ExprOp('ftan', float_st0)))
2347  e.append(m2_expr.ExprAff(float_st0,
2348  m2_expr.ExprOp('int_32_to_double',
2349  m2_expr.ExprInt32(1))))
2350  e.append(
2351  m2_expr.ExprAff(float_stack_ptr,
2352  float_stack_ptr + m2_expr.ExprInt(1, 3)))
2353  return e, []
2354 
def miasm2.arch.x86.sem.frndint (   ir,
  instr 
)

Definition at line 2355 of file sem.py.

2356 def frndint(ir, instr):
2357  e = []
2358  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('frndint', float_st0)))
2359  e += set_float_cs_eip(instr)
2360  return e, []
2361 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fscale (   ir,
  instr 
)

Definition at line 2392 of file sem.py.

2393 def fscale(ir, instr):
2394  e = []
2395  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fscale', float_st0,
2396  float_st1)))
2397  e += set_float_cs_eip(instr)
2398  return e, []
2399 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fsin (   ir,
  instr 
)

Definition at line 2362 of file sem.py.

2363 def fsin(ir, instr):
2364  e = []
2365  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fsin', float_st0)))
2366  e += set_float_cs_eip(instr)
2367  return e, []
2368 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fsincos (   ir,
  instr 
)

Definition at line 2376 of file sem.py.

2377 def fsincos(ir, instr):
2378  e = []
2379  e.append(m2_expr.ExprAff(float_st7, float_st6))
2380  e.append(m2_expr.ExprAff(float_st6, float_st5))
2381  e.append(m2_expr.ExprAff(float_st5, float_st4))
2382  e.append(m2_expr.ExprAff(float_st4, float_st3))
2383  e.append(m2_expr.ExprAff(float_st3, float_st2))
2384  e.append(m2_expr.ExprAff(float_st2, float_st1))
2385  e.append(m2_expr.ExprAff(float_st1, m2_expr.ExprOp('fsin', float_st0)))
2386  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fcos', float_st0)))
2387  e.append(
2388  m2_expr.ExprAff(float_stack_ptr,
2389  float_stack_ptr + m2_expr.ExprInt(1, 3)))
2390  return e, []
2391 
def miasm2.arch.x86.sem.fsqrt (   ir,
  instr 
)

Definition at line 2413 of file sem.py.

2414 def fsqrt(ir, instr):
2415  e = []
2416  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('fsqrt', float_st0)))
2417  e += set_float_cs_eip(instr)
2418  return e, []
2419 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fst (   ir,
  instr,
  a 
)

Definition at line 1971 of file sem.py.

1972 def fst(ir, instr, a):
1973  e = []
1974 
1975  if isinstance(a, m2_expr.ExprMem):
1976  if a.size > 64:
1977  raise NotImplementedError('float to long')
1978  src = m2_expr.ExprOp('double_to_mem_%.2d' % a.size, a)
1979  else:
1980  src = a
1981 
1982  e.append(m2_expr.ExprAff(a, src))
1983  e += set_float_cs_eip(instr)
1984  return e, []
1985 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.fstp (   ir,
  instr,
  a 
)

Definition at line 1986 of file sem.py.

1987 def fstp(ir, instr, a):
1988  e, extra = fst(ir, instr, a)
1989  e += float_pop(a)
1990  return e, extra
1991 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fsub (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2199 of file sem.py.

2200 def fsub(ir, instr, a, b=None):
2201  a, b = float_implicit_st0(a, b)
2202  e = []
2203  src = mem2double(b)
2204  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fsub', a, src)))
2205  e += set_float_cs_eip(instr)
2206  return e, []
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fsubp (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2207 of file sem.py.

2208 def fsubp(ir, instr, a, b=None):
2209  a, b = float_implicit_st0(a, b)
2210  e = []
2211  src = mem2double(b)
2212  e.append(m2_expr.ExprAff(float_prev(a), m2_expr.ExprOp('fsub', a, src)))
2213  e += set_float_cs_eip(instr)
2214  e += float_pop(a)
2215  return e, []
2216 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fsubr (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2217 of file sem.py.

2218 def fsubr(ir, instr, a, b=None):
2219  a, b = float_implicit_st0(a, b)
2220  e = []
2221  src = mem2double(b)
2222  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('fsub', src, a)))
2223  e += set_float_cs_eip(instr)
2224  return e, []
2225 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fsubrp (   ir,
  instr,
  a,
  b = None 
)

Definition at line 2226 of file sem.py.

2227 def fsubrp(ir, instr, a, b=None):
2228  a, b = float_implicit_st0(a, b)
2229  e = []
2230  src = mem2double(b)
2231  e.append(m2_expr.ExprAff(float_prev(a), m2_expr.ExprOp('fsub', src, a)))
2232  e += set_float_cs_eip(instr)
2233  e += float_pop(a)
2234  return e, []
2235 
def set_float_cs_eip
Definition: sem.py:159
def float_implicit_st0
Definition: sem.py:179

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.ftan (   ir,
  instr,
  a 
)

Definition at line 2320 of file sem.py.

2321 def ftan(ir, instr, a):
2322  e = []
2323  src = mem2double(a)
2324  e.append(m2_expr.ExprAff(float_st0, m2_expr.ExprOp('ftan', src)))
2325  e += set_float_cs_eip(instr)
2326  return e, []
2327 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.ftst (   ir,
  instr 
)

Definition at line 1787 of file sem.py.

1788 def ftst(ir, instr):
1789  a = float_st0
1790 
1791  e = []
1792  b = m2_expr.ExprOp('int_32_to_double', m2_expr.ExprInt32(0))
1793  e.append(m2_expr.ExprAff(float_c0, m2_expr.ExprOp('fcom_c0', a, b)))
1794  e.append(m2_expr.ExprAff(float_c1, m2_expr.ExprOp('fcom_c1', a, b)))
1795  e.append(m2_expr.ExprAff(float_c2, m2_expr.ExprOp('fcom_c2', a, b)))
1796  e.append(m2_expr.ExprAff(float_c3, m2_expr.ExprOp('fcom_c3', a, b)))
1797 
1798  e += set_float_cs_eip(instr)
1799  return e, []
1800 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fucom (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1896 of file sem.py.

1897 def fucom(ir, instr, a=None, b=None):
1898  # TODO unordered float
1899  return fcom(ir, instr, a, b)
1900 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fucomi (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1866 of file sem.py.

1867 def fucomi(ir, instr, a=None, b=None):
1868  # TODO unordered float
1869  return fcomi(ir, instr, a, b)

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fucomip (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1870 of file sem.py.

1871 def fucomip(ir, instr, a=None, b=None):
1872  # TODO unordered float
1873  return fcomip(ir, instr, a, b)
1874 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fucomp (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1901 of file sem.py.

1902 def fucomp(ir, instr, a=None, b=None):
1903  # TODO unordered float
1904  return fcomp(ir, instr, a, b)
1905 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fucompp (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1906 of file sem.py.

1907 def fucompp(ir, instr, a=None, b=None):
1908  # TODO unordered float
1909  return fcompp(ir, instr, a, b)
1910 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fwait (   ir,
  instr 
)

Definition at line 2451 of file sem.py.

2452 def fwait(ir, instr):
2453  return [], None
2454 
def miasm2.arch.x86.sem.fxam (   ir,
  instr 
)

Definition at line 1801 of file sem.py.

1802 def fxam(ir, instr):
1803  a = float_st0
1804 
1805  e = []
1806  e.append(m2_expr.ExprAff(float_c0, m2_expr.ExprOp('fxam_c0', a)))
1807  e.append(m2_expr.ExprAff(float_c2, m2_expr.ExprOp('fxam_c2', a)))
1808  e.append(m2_expr.ExprAff(float_c3, m2_expr.ExprOp('fxam_c3', a)))
1809 
1810  e += set_float_cs_eip(instr)
1811  return e, []
1812 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fxch (   ir,
  instr,
  a 
)

Definition at line 2328 of file sem.py.

2329 def fxch(ir, instr, a):
2330  e = []
2331  src = mem2double(a)
2332  e.append(m2_expr.ExprAff(float_st0, src))
2333  e.append(m2_expr.ExprAff(src, float_st0))
2334  e += set_float_cs_eip(instr)
2335  return e, []
2336 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.fyl2x (   ir,
  instr 
)

Definition at line 2154 of file sem.py.

2155 def fyl2x(ir, instr):
2156  e = []
2157  a = float_st1
2158  e.append(m2_expr.ExprAff(float_prev(a), m2_expr.ExprOp('fyl2x', float_st0, float_st1)))
2159  e += set_float_cs_eip(instr)
2160  e += float_pop(a)
2161  return e, []
2162 
def set_float_cs_eip
Definition: sem.py:159

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.gen_cmov (   ir,
  instr,
  cond,
  arg1,
  arg2,
  mov_if 
)
Generate cmov
@ir: ir instance
@instr: instruction instance
@cond: condition
@mov_if: invert condition if False

Definition at line 234 of file sem.py.

235 def gen_cmov(ir, instr, cond, arg1, arg2, mov_if):
236  """Generate cmov
237  @ir: ir instance
238  @instr: instruction instance
239  @cond: condition
240  @mov_if: invert condition if False"""
241 
242  lbl_do = m2_expr.ExprId(ir.gen_label(), instr.mode)
243  lbl_skip = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
244  if mov_if:
245  dstA, dstB = lbl_do, lbl_skip
246  else:
247  dstA, dstB = lbl_skip, lbl_do
248  e = []
249  e_do, extra_irs = mov(ir, instr, arg1, arg2)
250  e_do.append(m2_expr.ExprAff(ir.IRDst, lbl_skip))
251  e.append(m2_expr.ExprAff(ir.IRDst, m2_expr.ExprCond(cond, dstA, dstB)))
252  return e, [irbloc(lbl_do.name, [e_do])]
253 

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.gen_fcmov (   ir,
  instr,
  cond,
  arg1,
  arg2,
  mov_if 
)
Generate fcmov
@ir: ir instance
@instr: instruction instance
@cond: condition
@mov_if: invert condition if False

Definition at line 214 of file sem.py.

215 def gen_fcmov(ir, instr, cond, arg1, arg2, mov_if):
216  """Generate fcmov
217  @ir: ir instance
218  @instr: instruction instance
219  @cond: condition
220  @mov_if: invert condition if False"""
221 
222  lbl_do = m2_expr.ExprId(ir.gen_label(), instr.mode)
223  lbl_skip = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
224  if mov_if:
225  dstA, dstB = lbl_do, lbl_skip
226  else:
227  dstA, dstB = lbl_skip, lbl_do
228  e = []
229  e_do, extra_irs = [m2_expr.ExprAff(arg1, arg2)], []
230  e_do.append(m2_expr.ExprAff(ir.IRDst, lbl_skip))
231  e.append(m2_expr.ExprAff(ir.IRDst, m2_expr.ExprCond(cond, dstA, dstB)))
232  return e, [irbloc(lbl_do.name, [e_do])]
233 

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.gen_jcc (   ir,
  instr,
  cond,
  dst,
  jmp_if 
)
Macro to generate jcc semantic
@ir: ir instance
@instr: instruction
@cond: condtion of the jcc
@dst: the dstination if jcc is taken
@jmp_if: jump if/notif cond

Definition at line 189 of file sem.py.

190 def gen_jcc(ir, instr, cond, dst, jmp_if):
191  """
192  Macro to generate jcc semantic
193  @ir: ir instance
194  @instr: instruction
195  @cond: condtion of the jcc
196  @dst: the dstination if jcc is taken
197  @jmp_if: jump if/notif cond
198  """
199 
200  e = []
201  meip = mRIP[instr.mode]
202  next_lbl = m2_expr.ExprId(ir.get_next_label(instr), dst.size)
203  if jmp_if:
204  dstA, dstB = dst, next_lbl
205  else:
206  dstA, dstB = next_lbl, dst
207  mn_dst = m2_expr.ExprCond(cond,
208  dstA.zeroExtend(instr.mode),
209  dstB.zeroExtend(instr.mode))
210  e.append(m2_expr.ExprAff(meip, mn_dst))
211  e.append(m2_expr.ExprAff(ir.IRDst, mn_dst))
212  return e, []
213 

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.get_shift (   a,
  b 
)

Definition at line 410 of file sem.py.

411 def get_shift(a, b):
412  # b.size must match a
413  b = b.zeroExtend(a.size)
414  if a.size == 64:
415  shift = b & m2_expr.ExprInt_from(b, 0x3f)
416  else:
417  shift = b & m2_expr.ExprInt_from(b, 0x1f)
418  shift = expr_simp(shift)
419  return shift
420 

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.hlt (   ir,
  instr 
)

Definition at line 2491 of file sem.py.

2492 def hlt(ir, instr):
2493  e = []
2494  except_int = EXCEPT_PRIV_INSN
2495  e.append(m2_expr.ExprAff(exception_flags, m2_expr.ExprInt32(except_int)))
2496  return e, []
2497 
def miasm2.arch.x86.sem.icebp (   ir,
  instr 
)

Definition at line 2785 of file sem.py.

2786 def icebp(ir, instr):
2787  e = []
2788  e.append(m2_expr.ExprAff(exception_flags,
2789  m2_expr.ExprInt32(EXCEPT_PRIV_INSN)))
2790  return e, []
2791 # XXX
2792 
def miasm2.arch.x86.sem.idiv (   ir,
  instr,
  a 
)

Definition at line 1449 of file sem.py.

1450 def idiv(ir, instr, a):
1451  e = []
1452  size = a.size
1453 
1454  if size == 8:
1455  b = mRAX[instr.mode][:16]
1456  elif size in [16, 32]:
1457  s1, s2 = mRDX[size], mRAX[size]
1458  b = m2_expr.ExprCompose([(s2, 0, size),
1459  (s1, size, size*2)])
1460  else:
1461  raise ValueError('div arg not impl', a)
1462 
1463  c_d = m2_expr.ExprOp('idiv', b, a.signExtend(b.size))
1464  c_r = m2_expr.ExprOp('imod', b, a.signExtend(b.size))
1465 
1466  # if 8 bit div, only ax is affected
1467  if size == 8:
1468  e.append(m2_expr.ExprAff(b, m2_expr.ExprCompose([(c_d[:8], 0, 8),
1469  (c_r[:8], 8, 16)])))
1470  else:
1471  e.append(m2_expr.ExprAff(s1, c_r[:size]))
1472  e.append(m2_expr.ExprAff(s2, c_d[:size]))
1473  return e, []
1474 
1475 # XXX size to do; eflag
1476 
def miasm2.arch.x86.sem.imul (   ir,
  instr,
  a,
  b = None,
  c = None 
)

Definition at line 1505 of file sem.py.

1506 def imul(ir, instr, a, b=None, c=None):
1507  e = []
1508  size = a.size
1509  if b is None:
1510  if size in [16, 32, 64]:
1511  result = m2_expr.ExprOp('*',
1512  mRAX[size].signExtend(size * 2),
1513  a.signExtend(size * 2))
1514  e.append(m2_expr.ExprAff(mRAX[size], result[:size]))
1515  e.append(m2_expr.ExprAff(mRDX[size], result[size:size * 2]))
1516  elif size == 8:
1517  dst = mRAX[instr.mode][:16]
1518  result = m2_expr.ExprOp('*',
1519  mRAX[instr.mode][:8].signExtend(16),
1520  a.signExtend(16))
1521 
1522  e.append(m2_expr.ExprAff(dst, result))
1523  value = m2_expr.ExprCond(result - result[:size].signExtend(size * 2),
1524  m2_expr.ExprInt1(1),
1525  m2_expr.ExprInt1(0))
1526  e.append(m2_expr.ExprAff(cf, value))
1527  value = m2_expr.ExprCond(result - result[:size].signExtend(size * 2),
1528  m2_expr.ExprInt1(1),
1529  m2_expr.ExprInt1(0))
1530  e.append(m2_expr.ExprAff(of, value))
1531 
1532  else:
1533  if c is None:
1534  c = b
1535  b = a
1536  result = m2_expr.ExprOp('*',
1537  b.signExtend(size * 2),
1538  c.signExtend(size * 2))
1539  e.append(m2_expr.ExprAff(a, result[:size]))
1540 
1541  value = m2_expr.ExprCond(result - result[:size].signExtend(size * 2),
1542  m2_expr.ExprInt1(1),
1543  m2_expr.ExprInt1(0))
1544  e.append(m2_expr.ExprAff(cf, value))
1545  value = m2_expr.ExprCond(result - result[:size].signExtend(size * 2),
1546  m2_expr.ExprInt1(1),
1547  m2_expr.ExprInt1(0))
1548  e.append(m2_expr.ExprAff(of, value))
1549  return e, []
1550 
def miasm2.arch.x86.sem.inc (   ir,
  instr,
  a 
)

Definition at line 671 of file sem.py.

672 def inc(ir, instr, a):
673  e = []
674  b = m2_expr.ExprInt_from(a, 1)
675  c = a + b
676  e += update_flag_arith(c)
677  e += update_flag_af(c)
678 
679  e.append(update_flag_add_of(a, b, c))
680  e.append(m2_expr.ExprAff(a, c))
681  return e, []
def update_flag_arith
Definition: sem.py:99
def update_flag_add_of
Definition: sem.py:124
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.ins (   ir,
  instr,
  size 
)

Definition at line 2696 of file sem.py.

2697 def ins(ir, instr, size):
2698  e = []
2699  e.append(m2_expr.ExprAff(exception_flags, m2_expr.ExprInt32(1 << 7)))
2700  return e, []
2701 
def miasm2.arch.x86.sem.into (   ir,
  instr 
)

Definition at line 2917 of file sem.py.

2918 def into(ir, instr):
2919  return [], None
2920 
def miasm2.arch.x86.sem.ja (   ir,
  instr,
  dst 
)

Definition at line 1311 of file sem.py.

1312 def ja(ir, instr, dst):
1313  return gen_jcc(ir, instr, cf|zf, dst, False)
1314 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jae (   ir,
  instr,
  dst 
)

Definition at line 1315 of file sem.py.

1316 def jae(ir, instr, dst):
1317  return gen_jcc(ir, instr, cf, dst, False)
1318 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jb (   ir,
  instr,
  dst 
)

Definition at line 1319 of file sem.py.

1320 def jb(ir, instr, dst):
1321  return gen_jcc(ir, instr, cf, dst, True)
1322 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jbe (   ir,
  instr,
  dst 
)

Definition at line 1323 of file sem.py.

1324 def jbe(ir, instr, dst):
1325  return gen_jcc(ir, instr, cf|zf, dst, True)
1326 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jcxz (   ir,
  instr,
  dst 
)

Definition at line 1287 of file sem.py.

1288 def jcxz(ir, instr, dst):
1289  return gen_jcc(ir, instr, mRCX[instr.mode][:16], dst, False)
1290 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jecxz (   ir,
  instr,
  dst 
)

Definition at line 1291 of file sem.py.

1292 def jecxz(ir, instr, dst):
1293  return gen_jcc(ir, instr, mRCX[instr.mode][:32], dst, False)
1294 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jg (   ir,
  instr,
  dst 
)

Definition at line 1331 of file sem.py.

1332 def jg(ir, instr, dst):
1333  return gen_jcc(ir, instr, zf|(nf-of), dst, False)
1334 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jge (   ir,
  instr,
  dst 
)

Definition at line 1327 of file sem.py.

1328 def jge(ir, instr, dst):
1329  return gen_jcc(ir, instr, nf-of, dst, False)
1330 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jl (   ir,
  instr,
  dst 
)

Definition at line 1335 of file sem.py.

1336 def jl(ir, instr, dst):
1337  return gen_jcc(ir, instr, nf-of, dst, True)
1338 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jle (   ir,
  instr,
  dst 
)

Definition at line 1339 of file sem.py.

1340 def jle(ir, instr, dst):
1341  return gen_jcc(ir, instr, zf|(nf-of), dst, True)
1342 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jmp (   ir,
  instr,
  dst 
)

Definition at line 1253 of file sem.py.

1254 def jmp(ir, instr, dst):
1255  e = []
1256  meip = mRIP[instr.mode]
1257  e.append(m2_expr.ExprAff(meip, dst)) # dst.zeroExtend(instr.mode)))
1258  e.append(m2_expr.ExprAff(ir.IRDst, dst)) # dst.zeroExtend(instr.mode)))
1259 
1260  if isinstance(dst, m2_expr.ExprMem):
1261  dst = meip
1262  return e, []
1263 
def miasm2.arch.x86.sem.jmpf (   ir,
  instr,
  a 
)

Definition at line 1264 of file sem.py.

1265 def jmpf(ir, instr, a):
1266  e = []
1267  meip = mRIP[instr.mode]
1268  s = instr.mode
1269  if (isinstance(a, m2_expr.ExprOp) and a.op == "segm"):
1270  segm = a.args[0]
1271  base = a.args[1]
1272  m1 = segm.zeroExtend(CS.size)#m2_expr.ExprMem(m2_expr.ExprOp('segm', segm, base), 16)
1273  m2 = base.zeroExtend(meip.size)#m2_expr.ExprMem(m2_expr.ExprOp('segm', segm, base + m2_expr.ExprInt_from(base, 2)), s)
1274  else:
1275  m1 = m2_expr.ExprMem(a, 16)
1276  m2 = m2_expr.ExprMem(a + m2_expr.ExprInt_from(a, 2), meip.size)
1277 
1278  e.append(m2_expr.ExprAff(CS, m1))
1279  e.append(m2_expr.ExprAff(meip, m2))
1280  e.append(m2_expr.ExprAff(ir.IRDst, m2))
1281  return e, []
1282 
def miasm2.arch.x86.sem.jno (   ir,
  instr,
  dst 
)

Definition at line 1355 of file sem.py.

1356 def jno(ir, instr, dst):
1357  return gen_jcc(ir, instr, of, dst, False)
1358 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jnp (   ir,
  instr,
  dst 
)

Definition at line 1307 of file sem.py.

1308 def jnp(ir, instr, dst):
1309  return gen_jcc(ir, instr, pf, dst, False)
1310 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jns (   ir,
  instr,
  dst 
)

Definition at line 1347 of file sem.py.

1348 def jns(ir, instr, dst):
1349  return gen_jcc(ir, instr, nf, dst, False)
1350 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jnz (   ir,
  instr,
  dst 
)

Definition at line 1299 of file sem.py.

1300 def jnz(ir, instr, dst):
1301  return gen_jcc(ir, instr, zf, dst, False)
1302 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jo (   ir,
  instr,
  dst 
)

Definition at line 1351 of file sem.py.

1352 def jo(ir, instr, dst):
1353  return gen_jcc(ir, instr, of, dst, True)
1354 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jp (   ir,
  instr,
  dst 
)

Definition at line 1303 of file sem.py.

1304 def jp(ir, instr, dst):
1305  return gen_jcc(ir, instr, pf, dst, True)
1306 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jrcxz (   ir,
  instr,
  dst 
)

Definition at line 1295 of file sem.py.

1296 def jrcxz(ir, instr, dst):
1297  return gen_jcc(ir, instr, mRCX[instr.mode], dst, False)
1298 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.js (   ir,
  instr,
  dst 
)

Definition at line 1343 of file sem.py.

1344 def js(ir, instr, dst):
1345  return gen_jcc(ir, instr, nf, dst, True)
1346 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.jz (   ir,
  instr,
  dst 
)

Definition at line 1283 of file sem.py.

1284 def jz(ir, instr, dst):
1285  return gen_jcc(ir, instr, zf, dst, True)
1286 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.l_and (   ir,
  instr,
  a,
  b 
)

Definition at line 394 of file sem.py.

395 def l_and(ir, instr, a, b):
396  e = []
397  c = a & b
398  e += update_flag_logic(c)
399  e.append(m2_expr.ExprAff(a, c))
400  return e, []
401 
def update_flag_logic
Definition: sem.py:91

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.l_cmp (   ir,
  instr,
  a,
  b 
)

Definition at line 363 of file sem.py.

364 def l_cmp(ir, instr, a, b):
365  e = []
366  c = a - b
367  e += update_flag_arith(c)
368  e += update_flag_sub(a, b, c)
369  e += update_flag_af(c)
370  return e, []
371 
def update_flag_sub
Definition: sem.py:152
def update_flag_arith
Definition: sem.py:99
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.l_in (   ir,
  instr,
  a,
  b 
)

Definition at line 2921 of file sem.py.

2922 def l_in(ir, instr, a, b):
2923  e = []
2924  e.append(m2_expr.ExprAff(exception_flags,
2925  m2_expr.ExprInt32(EXCEPT_PRIV_INSN)))
2926  return e, []
2927 
def miasm2.arch.x86.sem.l_int (   ir,
  instr,
  a 
)

Definition at line 2793 of file sem.py.

2794 def l_int(ir, instr, a):
2795  e = []
2796  # XXX
2797  if a.arg in [1, 3]:
2798  except_int = EXCEPT_SOFT_BP
2799  else:
2800  except_int = EXCEPT_INT_XX
2801  e.append(m2_expr.ExprAff(exception_flags,
2802  m2_expr.ExprInt32(except_int)))
2803  return e, []
2804 
def miasm2.arch.x86.sem.l_not (   ir,
  instr,
  b 
)

Definition at line 356 of file sem.py.

357 def l_not(ir, instr, b):
358  e = []
359  c = ~b
360  e.append(m2_expr.ExprAff(b, c))
361  return e, []
362 
def miasm2.arch.x86.sem.l_or (   ir,
  instr,
  a,
  b 
)

Definition at line 386 of file sem.py.

387 def l_or(ir, instr, a, b):
388  e = []
389  c = a | b
390  e += update_flag_logic(c)
391  e.append(m2_expr.ExprAff(a, c))
392  return e, []
393 
def update_flag_logic
Definition: sem.py:91

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.l_out (   ir,
  instr,
  a,
  b 
)

Definition at line 2814 of file sem.py.

2815 def l_out(ir, instr, a, b):
2816  e = []
2817  e.append(m2_expr.ExprAff(exception_flags,
2818  m2_expr.ExprInt32(EXCEPT_PRIV_INSN)))
2819  return e, []
2820 
2821 # XXX
2822 
def miasm2.arch.x86.sem.l_outs (   ir,
  instr,
  size 
)

Definition at line 2823 of file sem.py.

2824 def l_outs(ir, instr, size):
2825  e = []
2826  e.append(m2_expr.ExprAff(exception_flags,
2827  m2_expr.ExprInt32(EXCEPT_PRIV_INSN)))
2828  return e, []
2829 
2830 # XXX actually, xlat performs al = (ds:[e]bx + ZeroExtend(al))
2831 
def miasm2.arch.x86.sem.l_rol (   ir,
  instr,
  a,
  b 
)

Definition at line 421 of file sem.py.

422 def l_rol(ir, instr, a, b):
423  e = []
424  shifter = get_shift(a, b)
425  c = m2_expr.ExprOp('<<<', a, shifter)
426 
427  new_cf = c[:1]
428  e.append(m2_expr.ExprAff(cf, new_cf))
429  # hack (only valid if b=1)
430  e.append(m2_expr.ExprAff(of, c.msb() ^ new_cf))
431  e.append(m2_expr.ExprAff(a, c))
432  return e, []
433 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.l_ror (   ir,
  instr,
  a,
  b 
)

Definition at line 434 of file sem.py.

435 def l_ror(ir, instr, a, b):
436  e = []
437  shifter = get_shift(a, b)
438  c = m2_expr.ExprOp('>>>', a, shifter)
439 
440  e.append(m2_expr.ExprAff(cf, c.msb()))
441  # hack (only valid if b=1): when count == 1: a = msb-1(dest)
442  e.append(m2_expr.ExprAff(of, (c ^ a).msb()))
443  e.append(m2_expr.ExprAff(a, c))
444  return e, []
445 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.l_str (   ir,
  instr,
  a 
)

Definition at line 3038 of file sem.py.

3039 def l_str(ir, instr, a):
3040  e = []
3041  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('load_tr_segment_selector',
3042  m2_expr.ExprInt32(0))))
3043  return e, []
3044 
def miasm2.arch.x86.sem.l_sysenter (   ir,
  instr 
)

Definition at line 2805 of file sem.py.

2806 def l_sysenter(ir, instr):
2807  e = []
2808  e.append(m2_expr.ExprAff(exception_flags,
2809  m2_expr.ExprInt32(EXCEPT_PRIV_INSN)))
2810  return e, []
2811 
2812 # XXX
2813 
def miasm2.arch.x86.sem.l_test (   ir,
  instr,
  a,
  b 
)

Definition at line 402 of file sem.py.

403 def l_test(ir, instr, a, b):
404  e = []
405  c = a & b
406  e += update_flag_logic(c)
407  return e, []
408 
409 
def update_flag_logic
Definition: sem.py:91

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.lahf (   ir,
  instr 
)

Definition at line 2992 of file sem.py.

2993 def lahf(ir, instr):
2994  e = []
2995  args = []
2996  regs = [cf, m2_expr.ExprInt1(1), pf, m2_expr.ExprInt1(0), af,
2997  m2_expr.ExprInt1(0), zf, nf]
2998  for i in xrange(len(regs)):
2999  args.append((regs[i], i, i + 1))
3000  e.append(m2_expr.ExprAff(mRAX[instr.mode][8:16], m2_expr.ExprCompose(args)))
3001  return e, []
3002 
def miasm2.arch.x86.sem.lar (   ir,
  instr,
  a,
  b 
)

Definition at line 3014 of file sem.py.

3015 def lar(ir, instr, a, b):
3016  e = []
3017  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('access_segment', b)))
3018  e.append(m2_expr.ExprAff(zf, m2_expr.ExprOp('access_segment_ok', b)))
3019  return e, []
3020 
def miasm2.arch.x86.sem.lds (   ir,
  instr,
  a,
  b 
)

Definition at line 2949 of file sem.py.

2950 def lds(ir, instr, a, b):
2951  e = []
2952  e.append(m2_expr.ExprAff(a, m2_expr.ExprMem(b.arg, size=a.size)))
2953  DS_value = m2_expr.ExprMem(b.arg + m2_expr.ExprInt_from(b.arg, a.size/8),
2954  size=16)
2955  e.append(m2_expr.ExprAff(DS, DS_value))
2956  return e, []
2957 
def miasm2.arch.x86.sem.lea (   ir,
  instr,
  a,
  b 
)

Definition at line 279 of file sem.py.

280 def lea(ir, instr, a, b):
281  src = b.arg
282  if src.size > a.size:
283  src = src[:a.size]
284  e = [m2_expr.ExprAff(a, src.zeroExtend(a.size))]
285  return e, []
286 
def miasm2.arch.x86.sem.leave (   ir,
  instr 
)

Definition at line 1222 of file sem.py.

1223 def leave(ir, instr):
1224  opmode, admode = instr.v_opmode(), instr.v_admode()
1225  size = instr.mode
1226  myesp = mRSP[size]
1227  e = []
1228  e.append(m2_expr.ExprAff(mRBP[size],
1229  m2_expr.ExprMem(mRBP[size], size=size)))
1230  e.append(m2_expr.ExprAff(myesp,
1231  m2_expr.ExprInt(size / 8, size) + mRBP[size]))
1232  return e, []
1233 
def miasm2.arch.x86.sem.les (   ir,
  instr,
  a,
  b 
)

Definition at line 2958 of file sem.py.

2959 def les(ir, instr, a, b):
2960  e = []
2961  e.append(m2_expr.ExprAff(a, m2_expr.ExprMem(b.arg, size=a.size)))
2962  ES_value = m2_expr.ExprMem(b.arg + m2_expr.ExprInt_from(b.arg, a.size/8),
2963  size=16)
2964  e.append(m2_expr.ExprAff(ES, ES_value))
2965  return e, []
2966 
def miasm2.arch.x86.sem.lfs (   ir,
  instr,
  a,
  b 
)

Definition at line 2975 of file sem.py.

2976 def lfs(ir, instr, a, b):
2977  e = []
2978  e.append(m2_expr.ExprAff(a, m2_expr.ExprMem(b.arg, size=a.size)))
2979  FS_value = m2_expr.ExprMem(b.arg + m2_expr.ExprInt_from(b.arg, a.size/8),
2980  size=16)
2981  e.append(m2_expr.ExprAff(FS, FS_value))
2982  return e, []
def miasm2.arch.x86.sem.lgs (   ir,
  instr,
  a,
  b 
)

Definition at line 2983 of file sem.py.

2984 def lgs(ir, instr, a, b):
2985  e = []
2986  e.append(m2_expr.ExprAff(a, m2_expr.ExprMem(b.arg, size=a.size)))
2987  GS_value = m2_expr.ExprMem(b.arg + m2_expr.ExprInt_from(b.arg, a.size/8),
2988  size=16)
2989  e.append(m2_expr.ExprAff(GS, GS_value))
2990  return e, []
2991 
def miasm2.arch.x86.sem.lods (   ir,
  instr,
  size 
)

Definition at line 1641 of file sem.py.

1642 def lods(ir, instr, size):
1643  lbl_df_0 = m2_expr.ExprId(ir.gen_label(), instr.mode)
1644  lbl_df_1 = m2_expr.ExprId(ir.gen_label(), instr.mode)
1645  lbl_next = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
1646  e = []
1647  s = instr.v_admode()
1648 
1649  addr_o = mRSI[instr.mode][:s]
1650  addr = addr_o
1651  addr_p = addr + m2_expr.ExprInt_from(addr, size / 8)
1652  addr_m = addr - m2_expr.ExprInt_from(addr, size / 8)
1653  if ir.do_str_segm:
1654  mss = DS
1655  if instr.additional_info.g2.value:
1656  raise NotImplementedError("add segm support")
1657  addr = m2_expr.ExprOp('segm', mss, addr)
1658 
1659  b = mRAX[instr.mode][:size]
1660 
1661  e0 = []
1662  e0.append(m2_expr.ExprAff(addr_o, addr_p))
1663  e0.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
1664  e0 = irbloc(lbl_df_0.name, [e0])
1665 
1666  e1 = []
1667  e1.append(m2_expr.ExprAff(addr_o, addr_m))
1668  e1.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
1669  e1 = irbloc(lbl_df_1.name, [e1])
1670 
1671  e = []
1672  e.append(m2_expr.ExprAff(b, m2_expr.ExprMem(addr, size)))
1673 
1674  e.append(m2_expr.ExprAff(ir.IRDst,
1675  m2_expr.ExprCond(df, lbl_df_1, lbl_df_0)))
1676  return e, [e0, e1]
1677 
def miasm2.arch.x86.sem.loop (   ir,
  instr,
  dst 
)

Definition at line 1359 of file sem.py.

1360 def loop(ir, instr, dst):
1361  e = []
1362  meip = mRIP[instr.mode]
1363  s = instr.v_opmode()
1364  opmode, admode = s, instr.v_admode()
1365  myecx = mRCX[instr.mode][:admode]
1366 
1367  n = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
1368  c = myecx - m2_expr.ExprInt_from(myecx, 1)
1369  dst_o = m2_expr.ExprCond(c,
1370  dst.zeroExtend(instr.mode),
1371  n.zeroExtend(instr.mode))
1372  e.append(m2_expr.ExprAff(myecx, c))
1373  e.append(m2_expr.ExprAff(meip, dst_o))
1374  e.append(m2_expr.ExprAff(ir.IRDst, dst_o))
1375  return e, []
1376 
def miasm2.arch.x86.sem.loope (   ir,
  instr,
  dst 
)

Definition at line 1400 of file sem.py.

1401 def loope(ir, instr, dst):
1402  e = []
1403  meip = mRIP[instr.mode]
1404  s = instr.v_opmode()
1405  opmode, admode = s, instr.v_admode()
1406  myecx = mRCX[instr.mode][:admode]
1407 
1408  n = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
1409  c = m2_expr.ExprCond(mRCX[instr.mode][:s] - m2_expr.ExprInt(1, s),
1410  m2_expr.ExprInt1(1),
1411  m2_expr.ExprInt1(0))
1412  c &= zf
1413  e.append(m2_expr.ExprAff(myecx, myecx - m2_expr.ExprInt_from(myecx, 1)))
1414  dst_o = m2_expr.ExprCond(c,
1415  dst.zeroExtend(instr.mode),
1416  n.zeroExtend(instr.mode))
1417  e.append(m2_expr.ExprAff(meip, dst_o))
1418  e.append(m2_expr.ExprAff(ir.IRDst, dst_o))
1419  return e, []
1420 
1421 
# XXX size to do; eflag
def miasm2.arch.x86.sem.loopne (   ir,
  instr,
  dst 
)

Definition at line 1377 of file sem.py.

1378 def loopne(ir, instr, dst):
1379  e = []
1380  meip = mRIP[instr.mode]
1381  s = instr.v_opmode()
1382  opmode, admode = s, instr.v_admode()
1383  myecx = mRCX[instr.mode][:admode]
1384 
1385  n = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
1386 
1387  c = m2_expr.ExprCond(mRCX[instr.mode][:s] - m2_expr.ExprInt(1, s),
1388  m2_expr.ExprInt1(1),
1389  m2_expr.ExprInt1(0))
1390  c &= zf ^ m2_expr.ExprInt1(1)
1391 
1392  e.append(m2_expr.ExprAff(myecx, myecx - m2_expr.ExprInt_from(myecx, 1)))
1393  dst_o = m2_expr.ExprCond(c,
1394  dst.zeroExtend(instr.mode),
1395  n.zeroExtend(instr.mode))
1396  e.append(m2_expr.ExprAff(meip, dst_o))
1397  e.append(m2_expr.ExprAff(ir.IRDst, dst_o))
1398  return e, []
1399 
def miasm2.arch.x86.sem.lsl (   ir,
  instr,
  a,
  b 
)

Definition at line 3021 of file sem.py.

3022 def lsl(ir, instr, a, b):
3023  e = []
3024  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('load_segment_limit', b)))
3025  e.append(m2_expr.ExprAff(zf, m2_expr.ExprOp('load_segment_limit_ok', b)))
3026  return e, []
3027 
def miasm2.arch.x86.sem.lss (   ir,
  instr,
  a,
  b 
)

Definition at line 2967 of file sem.py.

2968 def lss(ir, instr, a, b):
2969  e = []
2970  e.append(m2_expr.ExprAff(a, m2_expr.ExprMem(b.arg, size=a.size)))
2971  SS_value = m2_expr.ExprMem(b.arg + m2_expr.ExprInt_from(b.arg, a.size/8),
2972  size=16)
2973  e.append(m2_expr.ExprAff(SS, SS_value))
2974  return e, []
def miasm2.arch.x86.sem.mem2double (   arg)
Add float convertion if argument is an ExprMem
@arg: argument to tranform

Definition at line 167 of file sem.py.

168 def mem2double(arg):
169  """
170  Add float convertion if argument is an ExprMem
171  @arg: argument to tranform
172  """
173  if isinstance(arg, m2_expr.ExprMem):
174  if arg.size > 64:
175  raise NotImplementedError('float to long')
176  return m2_expr.ExprOp('mem_%.2d_to_double' % arg.size, arg)
177  else:
178  return arg

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.mov (   ir,
  instr,
  a,
  b 
)

Definition at line 254 of file sem.py.

255 def mov(ir, instr, a, b):
256  if a in [ES, CS, SS, DS, FS, GS]:
257  b = b[:a.size]
258  if b in [ES, CS, SS, DS, FS, GS]:
259  b = b.zeroExtend(a.size)
260  e = [m2_expr.ExprAff(a, b)]
261  return e, []
262 

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.movapd (   ir,
  instr,
  a,
  b 
)

Definition at line 3062 of file sem.py.

3063 def movapd(ir, instr, a, b):
3064  # XXX TODO alignement check
3065  return [m2_expr.ExprAff(a, b)], []
3066 
def miasm2.arch.x86.sem.movd (   ir,
  instr,
  a,
  b 
)

Definition at line 3045 of file sem.py.

3046 def movd(ir, instr, a, b):
3047  e = []
3048  if a in regs_mm_expr:
3049  e.append(m2_expr.ExprAff(a, m2_expr.ExprCompose([(b, 0, 32),
3050  (m2_expr.ExprInt32(0), 32, 64)])))
3051  elif a in regs_xmm_expr:
3052  e.append(m2_expr.ExprAff(a, m2_expr.ExprCompose([(b, 0, 32),
3053  (m2_expr.ExprInt(0, 96), 32, 128)])))
3054  else:
3055  e.append(m2_expr.ExprAff(a, b[:32]))
3056  return e, []
def miasm2.arch.x86.sem.movdqu (   ir,
  instr,
  a,
  b 
)

Definition at line 3057 of file sem.py.

3058 def movdqu(ir, instr, a, b):
3059  # XXX TODO alignement check
3060  return [m2_expr.ExprAff(a, b)], []
3061 
def miasm2.arch.x86.sem.movs (   ir,
  instr,
  size 
)

Definition at line 1678 of file sem.py.

1679 def movs(ir, instr, size):
1680  lbl_df_0 = m2_expr.ExprId(ir.gen_label(), instr.mode)
1681  lbl_df_1 = m2_expr.ExprId(ir.gen_label(), instr.mode)
1682  lbl_next = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
1683 
1684  s = instr.v_admode()
1685  # a = m2_expr.ExprMem(mRDI[instr.mode][:s], size)
1686  # b = m2_expr.ExprMem(mRSI[instr.mode][:s], size)
1687 
1688  a = mRDI[instr.mode][:s]
1689  b = mRSI[instr.mode][:s]
1690 
1691  e = []
1692  src = b
1693  dst = a
1694  if ir.do_str_segm:
1695  if instr.additional_info.g2.value:
1696  raise NotImplementedError("add segm support")
1697  src = m2_expr.ExprOp('segm', DS, src)
1698  dst = m2_expr.ExprOp('segm', ES, dst)
1699  e.append(m2_expr.ExprAff(m2_expr.ExprMem(dst, size),
1700  m2_expr.ExprMem(src, size)))
1701 
1702  e0 = []
1703  e0.append(m2_expr.ExprAff(a, a + m2_expr.ExprInt_from(a, size / 8)))
1704  e0.append(m2_expr.ExprAff(b, b + m2_expr.ExprInt_from(b, size / 8)))
1705  e0.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
1706  e0 = irbloc(lbl_df_0.name, [e0])
1707 
1708  e1 = []
1709  e1.append(m2_expr.ExprAff(a, a - m2_expr.ExprInt_from(a, size / 8)))
1710  e1.append(m2_expr.ExprAff(b, b - m2_expr.ExprInt_from(b, size / 8)))
1711  e1.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
1712  e1 = irbloc(lbl_df_1.name, [e1])
1713 
1714  e.append(m2_expr.ExprAff(ir.IRDst,
1715  m2_expr.ExprCond(df, lbl_df_1, lbl_df_0)))
1716  return e, [e0, e1]

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.movsd (   ir,
  instr,
  a,
  b 
)

Definition at line 1717 of file sem.py.

1718 def movsd(ir, instr, a, b):
1719  e = []
1720  if isinstance(a, m2_expr.ExprId) and isinstance(b, m2_expr.ExprMem):
1721  b = m2_expr.ExprMem(b.arg, a.size)
1722  elif isinstance(a, m2_expr.ExprMem) and isinstance(b, m2_expr.ExprId):
1723  a = m2_expr.ExprMem(a.arg, b.size)
1724 
1725  e.append(m2_expr.ExprAff(a, b))
1726  return e, []

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.movsd_dispatch (   ir,
  instr,
  a = None,
  b = None 
)

Definition at line 1727 of file sem.py.

1728 def movsd_dispatch(ir, instr, a = None, b = None):
1729  if a is None and b is None:
1730  return movs(ir, instr, 32)
1731  else:
1732  return movsd(ir, instr, a, b)
1733 
def movsd_dispatch
Definition: sem.py:1727

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.movss (   ir,
  instr,
  a,
  b 
)

Definition at line 3366 of file sem.py.

3367 def movss(ir, instr, a, b):
3368  e = []
3369  if not isinstance(a, m2_expr.ExprMem) and not isinstance(b, m2_expr.ExprMem):
3370  # Source and Destination xmm
3371  e.append(m2_expr.ExprAff(a[:32], b[:32]))
3372  elif not isinstance(b, m2_expr.ExprMem) and isinstance(a, m2_expr.ExprMem):
3373  # Source XMM Destination Mem
3374  e.append(m2_expr.ExprAff(a, b[:32]))
3375  else:
3376  # Source Mem Destination XMM
3377  e.append(m2_expr.ExprAff(a, m2_expr.ExprCompose([(b, 0, 32),
3378  (m2_expr.ExprInt(0, 96), 32, 128)])))
3379  return e, []
3380 
def miasm2.arch.x86.sem.movsx (   ir,
  instr,
  a,
  b 
)

Definition at line 274 of file sem.py.

275 def movsx(ir, instr, a, b):
276  e = [m2_expr.ExprAff(a, b.signExtend(a.size))]
277  return e, []
278 
def miasm2.arch.x86.sem.movzx (   ir,
  instr,
  a,
  b 
)

Definition at line 270 of file sem.py.

271 def movzx(ir, instr, a, b):
272  e = [m2_expr.ExprAff(a, b.zeroExtend(a.size))]
273  return e, []
def miasm2.arch.x86.sem.mul (   ir,
  instr,
  a 
)

Definition at line 1477 of file sem.py.

1478 def mul(ir, instr, a):
1479  e = []
1480  size = a.size
1481  if a.size in [16, 32, 64]:
1482  result = m2_expr.ExprOp('*',
1483  mRAX[size].zeroExtend(size * 2),
1484  a.zeroExtend(size * 2))
1485  e.append(m2_expr.ExprAff(mRAX[size], result[:size]))
1486  e.append(m2_expr.ExprAff(mRDX[size], result[size:size * 2]))
1487 
1488  elif a.size == 8:
1489  result = m2_expr.ExprOp('*',
1490  mRAX[instr.mode][:8].zeroExtend(16),
1491  a.zeroExtend(16))
1492  e.append(m2_expr.ExprAff(mRAX[instr.mode][:16], result))
1493  else:
1494  raise ValueError('unknow size')
1495 
1496  e.append(m2_expr.ExprAff(of, m2_expr.ExprCond(result[size:size * 2],
1497  m2_expr.ExprInt1(1),
1498  m2_expr.ExprInt1(0))))
1499  e.append(m2_expr.ExprAff(cf, m2_expr.ExprCond(result[size:size * 2],
1500  m2_expr.ExprInt1(1),
1501  m2_expr.ExprInt1(0))))
1502 
1503  return e, []
1504 
def miasm2.arch.x86.sem.neg (   ir,
  instr,
  b 
)

Definition at line 344 of file sem.py.

345 def neg(ir, instr, b):
346  e = []
347  a = m2_expr.ExprInt_from(b, 0)
348 
349  c = a - b
350  e += update_flag_arith(c)
351  e += update_flag_sub(a, b, c)
352  e += update_flag_af(c)
353  e.append(m2_expr.ExprAff(b, c))
354  return e, []
355 
def update_flag_sub
Definition: sem.py:152
def update_flag_arith
Definition: sem.py:99
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.nop (   ir,
  instr,
  a = None 
)

Definition at line 2487 of file sem.py.

2488 def nop(ir, instr, a=None):
2489  return [], []
2490 
def miasm2.arch.x86.sem.orps (   ir,
  instr,
  a,
  b 
)

Definition at line 3073 of file sem.py.

3074 def orps(ir, instr, a, b):
3075  e = []
3076  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('|', a, b)))
3077  return e, []
3078 
def miasm2.arch.x86.sem.pand (   ir,
  instr,
  a,
  b 
)

Logical (floating-point)

Definition at line 3213 of file sem.py.

3214 def pand(ir, instr, a, b):
3215  e = []
3216  c = a & b
3217  # No flag affected
3218  e.append(m2_expr.ExprAff(a, c))
3219  return e, []
3220 
def pand
Logical (floating-point)
Definition: sem.py:3213
def miasm2.arch.x86.sem.pminsw (   ir,
  instr,
  a,
  b 
)

Definition at line 3228 of file sem.py.

3229 def pminsw(ir, instr, a, b):
3230  e = []
3231  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond((a - b).msb(), a, b)))
3232  return e, []
def miasm2.arch.x86.sem.pop (   ir,
  instr,
  a 
)

Definition at line 739 of file sem.py.

740 def pop(ir, instr, a):
741  return pop_gen(ir, instr, a, instr.mode)

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.pop_gen (   ir,
  instr,
  a,
  size 
)

Definition at line 720 of file sem.py.

721 def pop_gen(ir, instr, a, size):
722  e = []
723  if not size in [16, 32, 64]:
724  raise ValueError('bad size stacker!')
725 
726  sp = mRSP[instr.mode]
727  new_sp = sp + m2_expr.ExprInt_from(sp, size / 8)
728  # don't generate ESP incrementation on POP ESP
729  if a != ir.sp:
730  e.append(m2_expr.ExprAff(sp, new_sp))
731  # XXX FIX XXX for pop [esp]
732  if isinstance(a, m2_expr.ExprMem):
733  a = a.replace_expr({sp: new_sp})
734  c = sp
735  if ir.do_stk_segm:
736  c = m2_expr.ExprOp('segm', SS, c)
737  e.append(m2_expr.ExprAff(a, m2_expr.ExprMem(c, a.size)))
738  return e, []

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.popad (   ir,
  instr 
)

Definition at line 1095 of file sem.py.

1096 def popad(ir, instr):
1097  e = []
1098  s = instr.v_opmode()
1099  opmode, admode = s, instr.v_admode()
1100  if not s in [16, 32, 64]:
1101  raise ValueError('bad size stacker!')
1102  regs = [
1103  mRAX[instr.mode][:s], mRCX[instr.mode][
1104  :s], mRDX[instr.mode][:s], mRBX[instr.mode][:s],
1105  mRSP[instr.mode][:s], mRBP[instr.mode][:s],
1106  mRSI[instr.mode][:s], mRDI[instr.mode][:s]]
1107  myesp = mRSP[instr.mode][:s]
1108  regs.reverse()
1109  for i in xrange(len(regs)):
1110  if regs[i] == myesp:
1111  continue
1112  c = myesp + m2_expr.ExprInt_from(myesp, ((s / 8) * i))
1113  e.append(m2_expr.ExprAff(regs[i], m2_expr.ExprMem(c, s)))
1114 
1115  c = myesp + m2_expr.ExprInt_from(myesp, ((s / 8) * (i + 1)))
1116  e.append(m2_expr.ExprAff(myesp, c))
1117 
1118  return e, []
1119 
def miasm2.arch.x86.sem.popfd (   ir,
  instr 
)

Definition at line 1025 of file sem.py.

1026 def popfd(ir, instr):
1027  tmp = m2_expr.ExprMem(mRSP[instr.mode])
1028  e = []
1029  e.append(m2_expr.ExprAff(cf, m2_expr.ExprSlice(tmp, 0, 1)))
1030  e.append(m2_expr.ExprAff(pf, m2_expr.ExprSlice(tmp, 2, 3)))
1031  e.append(m2_expr.ExprAff(af, m2_expr.ExprSlice(tmp, 4, 5)))
1032  e.append(m2_expr.ExprAff(zf, m2_expr.ExprSlice(tmp, 6, 7)))
1033  e.append(m2_expr.ExprAff(nf, m2_expr.ExprSlice(tmp, 7, 8)))
1034  e.append(m2_expr.ExprAff(tf, m2_expr.ExprSlice(tmp, 8, 9)))
1035  e.append(m2_expr.ExprAff(i_f, m2_expr.ExprSlice(tmp, 9, 10)))
1036  e.append(m2_expr.ExprAff(df, m2_expr.ExprSlice(tmp, 10, 11)))
1037  e.append(m2_expr.ExprAff(of, m2_expr.ExprSlice(tmp, 11, 12)))
1038  e.append(m2_expr.ExprAff(iopl, m2_expr.ExprSlice(tmp, 12, 14)))
1039  e.append(m2_expr.ExprAff(nt, m2_expr.ExprSlice(tmp, 14, 15)))
1040  e.append(m2_expr.ExprAff(rf, m2_expr.ExprSlice(tmp, 16, 17)))
1041  e.append(m2_expr.ExprAff(vm, m2_expr.ExprSlice(tmp, 17, 18)))
1042  e.append(m2_expr.ExprAff(ac, m2_expr.ExprSlice(tmp, 18, 19)))
1043  e.append(m2_expr.ExprAff(vif, m2_expr.ExprSlice(tmp, 19, 20)))
1044  e.append(m2_expr.ExprAff(vip, m2_expr.ExprSlice(tmp, 20, 21)))
1045  e.append(m2_expr.ExprAff(i_d, m2_expr.ExprSlice(tmp, 21, 22)))
1046  e.append(m2_expr.ExprAff(mRSP[instr.mode],
1047  mRSP[instr.mode] + m2_expr.ExprInt_from(mRSP[instr.mode], instr.mode/8)))
1048  e.append(m2_expr.ExprAff(exception_flags,
1049  m2_expr.ExprCond(m2_expr.ExprSlice(tmp, 8, 9),
1050  m2_expr.ExprInt32(EXCEPT_SOFT_BP),
1051  exception_flags
1052  )
1053  )
1054  )
1055  return e, []
1056 
def miasm2.arch.x86.sem.popfw (   ir,
  instr 
)

Definition at line 1057 of file sem.py.

1058 def popfw(ir, instr):
1059  tmp = m2_expr.ExprMem(mRSP[instr.mode])
1060  e = []
1061  e.append(m2_expr.ExprAff(cf, m2_expr.ExprSlice(tmp, 0, 1)))
1062  e.append(m2_expr.ExprAff(pf, m2_expr.ExprSlice(tmp, 2, 3)))
1063  e.append(m2_expr.ExprAff(af, m2_expr.ExprSlice(tmp, 4, 5)))
1064  e.append(m2_expr.ExprAff(zf, m2_expr.ExprSlice(tmp, 6, 7)))
1065  e.append(m2_expr.ExprAff(nf, m2_expr.ExprSlice(tmp, 7, 8)))
1066  e.append(m2_expr.ExprAff(tf, m2_expr.ExprSlice(tmp, 8, 9)))
1067  e.append(m2_expr.ExprAff(i_f, m2_expr.ExprSlice(tmp, 9, 10)))
1068  e.append(m2_expr.ExprAff(df, m2_expr.ExprSlice(tmp, 10, 11)))
1069  e.append(m2_expr.ExprAff(of, m2_expr.ExprSlice(tmp, 11, 12)))
1070  e.append(m2_expr.ExprAff(iopl, m2_expr.ExprSlice(tmp, 12, 14)))
1071  e.append(m2_expr.ExprAff(nt, m2_expr.ExprSlice(tmp, 14, 15)))
1072  e.append(m2_expr.ExprAff(mRSP[instr.mode], mRSP[instr.mode] + m2_expr.ExprInt(2, mRSP[instr.mode].size)))
1073  return e, []
1074 
def miasm2.arch.x86.sem.popw (   ir,
  instr,
  a 
)

Definition at line 742 of file sem.py.

743 def popw(ir, instr, a):
744  return pop_gen(ir, instr, a, 16)
745 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.por (   ir,
  instr,
  a,
  b 
)

Definition at line 3221 of file sem.py.

3222 def por(ir, instr, a, b):
3223  e = []
3224  c = a | b
3225  e.append(m2_expr.ExprAff(a, c))
3226  return e, []
3227 
def miasm2.arch.x86.sem.push (   ir,
  instr,
  a 
)

Definition at line 713 of file sem.py.

714 def push(ir, instr, a):
715  return push_gen(ir, instr, a, instr.mode)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.push_gen (   ir,
  instr,
  a,
  size 
)

Definition at line 694 of file sem.py.

695 def push_gen(ir, instr, a, size):
696  e = []
697  if not size in [16, 32, 64]:
698  raise ValueError('bad size stacker!')
699  if a.size < size:
700  a = a.zeroExtend(size)
701  elif a.size == size:
702  pass
703  else:
704  raise ValueError('strange arg size')
705 
706  sp = mRSP[instr.mode]
707  new_sp = sp - m2_expr.ExprInt_from(sp, size / 8)
708  e.append(m2_expr.ExprAff(sp, new_sp))
709  if ir.do_stk_segm:
710  new_sp = m2_expr.ExprOp('segm', SS, new_sp)
711  e.append(m2_expr.ExprAff(m2_expr.ExprMem(new_sp, size), a))
712  return e, []

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.pushad (   ir,
  instr 
)

Definition at line 1075 of file sem.py.

1076 def pushad(ir, instr):
1077  e = []
1078  s = instr.v_opmode()
1079  opmode, admode = s, instr.v_admode()
1080  if not s in [16, 32, 64]:
1081  raise ValueError('bad size stacker!')
1082 
1083  regs = [
1084  mRAX[instr.mode][:s], mRCX[instr.mode][
1085  :s], mRDX[instr.mode][:s], mRBX[instr.mode][:s],
1086  mRSP[instr.mode][:s], mRBP[instr.mode][:s],
1087  mRSI[instr.mode][:s], mRDI[instr.mode][:s]]
1088 
1089  for i in xrange(len(regs)):
1090  c = mRSP[instr.mode][:s] + m2_expr.ExprInt(-(s / 8) * (i + 1), s)
1091  e.append(m2_expr.ExprAff(m2_expr.ExprMem(c, s), regs[i]))
1092  e.append(m2_expr.ExprAff(mRSP[instr.mode][:s], c))
1093  return e, []
1094 
def miasm2.arch.x86.sem.pushfd (   ir,
  instr 
)

Definition at line 1015 of file sem.py.

1016 def pushfd(ir, instr):
1017  return push(ir, instr, compose_eflag())
def compose_eflag
Definition: sem.py:992

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.pushfq (   ir,
  instr 
)

Definition at line 1018 of file sem.py.

1019 def pushfq(ir, instr):
1020  return push(ir, instr, compose_eflag().zeroExtend(64))
def compose_eflag
Definition: sem.py:992

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.pushfw (   ir,
  instr 
)

Definition at line 1021 of file sem.py.

1022 def pushfw(ir, instr):
1023  return pushw(ir, instr, compose_eflag(16))
1024 
def compose_eflag
Definition: sem.py:992

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.pushw (   ir,
  instr,
  a 
)

Definition at line 716 of file sem.py.

717 def pushw(ir, instr, a):
718  return push_gen(ir, instr, a, 16)
719 

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.pxor (   ir,
  instr,
  a,
  b 
)

Definition at line 380 of file sem.py.

381 def pxor(ir, instr, a, b):
382  e = []
383  c = a ^ b
384  e.append(m2_expr.ExprAff(a, c))
385  return e, []
def miasm2.arch.x86.sem.rcl (   ir,
  instr,
  a,
  b 
)

Definition at line 446 of file sem.py.

447 def rcl(ir, instr, a, b):
448  e = []
449  shifter = get_shift(a, b)
450  c = m2_expr.ExprOp('<<<c_rez', a, shifter, cf.zeroExtend(a.size))
451  new_cf = m2_expr.ExprOp('<<<c_cf', a, shifter, cf.zeroExtend(a.size))[:1]
452 
453  e.append(m2_expr.ExprAff(cf, new_cf))
454  # hack (only valid if b=1)
455  e.append(m2_expr.ExprAff(of, c.msb() ^ new_cf))
456  e.append(m2_expr.ExprAff(a, c))
457  return e, []
458 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.rcr (   ir,
  instr,
  a,
  b 
)

Definition at line 459 of file sem.py.

460 def rcr(ir, instr, a, b):
461  e = []
462  shifter = get_shift(a, b)
463  c = m2_expr.ExprOp('>>>c_rez', a, shifter, cf.zeroExtend(a.size))
464  new_cf = m2_expr.ExprOp('>>>c_cf', a, shifter, cf.zeroExtend(a.size))[:1]
465 
466  e.append(m2_expr.ExprAff(cf, new_cf))
467  # hack (only valid if b=1)
468  e.append(m2_expr.ExprAff(of, (a ^ c).msb()))
469  e.append(m2_expr.ExprAff(a, c))
470 
471  return e, []
472 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.rdmsr (   ir,
  instr 
)

Definition at line 3085 of file sem.py.

3086 def rdmsr(ir, instr):
3087  msr_addr = m2_expr.ExprId('MSR') + m2_expr.ExprInt32(8) * mRCX[instr.mode][:32]
3088  e = []
3089  e.append(m2_expr.ExprAff(mRAX[instr.mode][:32], m2_expr.ExprMem(msr_addr, 32)))
3090  e.append(m2_expr.ExprAff(mRDX[instr.mode][:32], m2_expr.ExprMem(msr_addr + m2_expr.ExprInt_from(msr_addr, 4), 32)))
3091  return e, []
def miasm2.arch.x86.sem.rdtsc (   ir,
  instr 
)

Definition at line 2498 of file sem.py.

2499 def rdtsc(ir, instr):
2500  e = []
2501  e.append(m2_expr.ExprAff(tsc1, tsc1 + m2_expr.ExprInt32(1)))
2502  e.append(m2_expr.ExprAff(mRAX[32], tsc1))
2503  e.append(m2_expr.ExprAff(mRDX[32], tsc2))
2504  return e, []
2505 
def miasm2.arch.x86.sem.ret (   ir,
  instr,
  a = None 
)

Definition at line 1168 of file sem.py.

1169 def ret(ir, instr, a=None):
1170  e = []
1171  s = instr.mode
1172  meip = mRIP[instr.mode]
1173  opmode, admode = instr.v_opmode(), instr.v_admode()
1174  s = opmode
1175  myesp = mRSP[instr.mode][:s]
1176 
1177  if a is None:
1178  a = m2_expr.ExprInt(0, s)
1179  value = (myesp + (m2_expr.ExprInt((s / 8), s)))
1180  else:
1181  a = a.zeroExtend(s)
1182  value = (myesp + (m2_expr.ExprInt((s / 8), s) + a))
1183 
1184  e.append(m2_expr.ExprAff(myesp, value))
1185  c = myesp
1186  if ir.do_stk_segm:
1187  c = m2_expr.ExprOp('segm', SS, c)
1188  e.append(m2_expr.ExprAff(meip, m2_expr.ExprMem(c, size=s).zeroExtend(s)))
1189  e.append(m2_expr.ExprAff(ir.IRDst,
1190  m2_expr.ExprMem(c, size=s).zeroExtend(s)))
1191  return e, []
1192 
def miasm2.arch.x86.sem.retf (   ir,
  instr,
  a = None 
)

Definition at line 1193 of file sem.py.

1194 def retf(ir, instr, a=None):
1195  e = []
1196  s = instr.mode
1197  meip = mRIP[instr.mode]
1198  opmode, admode = instr.v_opmode(), instr.v_admode()
1199  if a is None:
1200  a = m2_expr.ExprInt(0, s)
1201  s = opmode
1202  myesp = mRSP[instr.mode][:s]
1203 
1204  a = a.zeroExtend(s)
1205 
1206  c = myesp
1207  if ir.do_stk_segm:
1208  c = m2_expr.ExprOp('segm', SS, c)
1209  e.append(m2_expr.ExprAff(meip, m2_expr.ExprMem(c, size=s).zeroExtend(s)))
1210  e.append(m2_expr.ExprAff(ir.IRDst,
1211  m2_expr.ExprMem(c, size=s).zeroExtend(s)))
1212  # e.append(m2_expr.ExprAff(meip, m2_expr.ExprMem(c, size = s)))
1213  c = myesp + m2_expr.ExprInt(s / 8, s)
1214  if ir.do_stk_segm:
1215  c = m2_expr.ExprOp('segm', SS, c)
1216  e.append(m2_expr.ExprAff(CS, m2_expr.ExprMem(c, size=16)))
1217 
1218  value = myesp + (m2_expr.ExprInt((2*s) / 8, s) + a)
1219  e.append(m2_expr.ExprAff(myesp, value))
1220  return e, []
1221 
def miasm2.arch.x86.sem.sahf (   ir,
  instr 
)

Definition at line 3003 of file sem.py.

3004 def sahf(ir, instr):
3005  tmp = mRAX[instr.mode][8:16]
3006  e = []
3007  e.append(m2_expr.ExprAff(cf, tmp[0:1]))
3008  e.append(m2_expr.ExprAff(pf, tmp[2:3]))
3009  e.append(m2_expr.ExprAff(af, tmp[4:5]))
3010  e.append(m2_expr.ExprAff(zf, tmp[6:7]))
3011  e.append(m2_expr.ExprAff(nf, tmp[7:8]))
3012  return e, []
3013 
def miasm2.arch.x86.sem.sal (   ir,
  instr,
  a,
  b 
)

Definition at line 574 of file sem.py.

575 def sal(ir, instr, a, b):
576  e = []
577  shifter = get_shift(a, b)
578  c = m2_expr.ExprOp('a<<', a, shifter)
579  new_cf = (a >> (m2_expr.ExprInt_from(a, a.size) - shifter))[:1]
580  e.append(m2_expr.ExprAff(cf, m2_expr.ExprCond(shifter,
581  new_cf,
582  cf)
583  )
584  )
585  e += update_flag_znp(c)
586  e.append(m2_expr.ExprAff(of, c.msb() ^ new_cf))
587  e.append(m2_expr.ExprAff(a, c))
588  return e, []
589 
def update_flag_znp
Definition: sem.py:83

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.sar (   ir,
  instr,
  a,
  b 
)

Definition at line 473 of file sem.py.

474 def sar(ir, instr, a, b):
475 
476  shifter = get_shift(a, b)
477  c = m2_expr.ExprOp('a>>', a, shifter)
478 
479  lbl_do = m2_expr.ExprId(ir.gen_label(), instr.mode)
480  lbl_skip = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
481 
482  new_cf = m2_expr.ExprOp('a>>', a,(shifter - m2_expr.ExprInt_from(a, 1)))[:1]
483 
484  e_do = [
485  m2_expr.ExprAff(cf, new_cf),
486  m2_expr.ExprAff(of, m2_expr.ExprInt_from(of, 0)),
487  m2_expr.ExprAff(a, c),
488  ]
489 
490  e_do += update_flag_znp(c)
491 
492  # dont generate conditional shifter on constant
493  if isinstance(shifter, m2_expr.ExprInt):
494  if int(shifter.arg) != 0:
495  return e_do, []
496  else:
497  return [], []
498 
499  e_do.append(m2_expr.ExprAff(ir.IRDst, lbl_skip))
500 
501  e = []
502  e.append(m2_expr.ExprAff(ir.IRDst, m2_expr.ExprCond(shifter, lbl_do,
503  lbl_skip)))
504  return e, [irbloc(lbl_do.name, [e_do])]
505 
def update_flag_znp
Definition: sem.py:83

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.sbb (   ir,
  instr,
  a,
  b 
)

Definition at line 332 of file sem.py.

333 def sbb(ir, instr, a, b):
334  e = []
335  c = a - (b + m2_expr.ExprCompose([(m2_expr.ExprInt(0, a.size - 1),
336  1, a.size),
337  (cf, 0, 1)]))
338  e += update_flag_arith(c)
339  e += update_flag_af(c)
340  e += update_flag_sub(a, b, c)
341  e.append(m2_expr.ExprAff(a, c))
342  return e, []
343 
def update_flag_sub
Definition: sem.py:152
def update_flag_arith
Definition: sem.py:99
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.scas (   ir,
  instr,
  size 
)

Definition at line 963 of file sem.py.

964 def scas(ir, instr, size):
965  lbl_cmp = m2_expr.ExprId(ir.gen_label(), instr.mode)
966  lbl_df_0 = m2_expr.ExprId(ir.gen_label(), instr.mode)
967  lbl_df_1 = m2_expr.ExprId(ir.gen_label(), instr.mode)
968  lbl_next = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
969 
970  s = instr.v_admode()
971  a = m2_expr.ExprMem(mRDI[instr.mode][:s], size)
972 
973  e, extra = l_cmp(ir, instr, mRAX[instr.mode][:size], a)
974 
975  e0 = []
976  e0.append(m2_expr.ExprAff(a.arg,
977  a.arg + m2_expr.ExprInt_from(a.arg, size / 8)))
978  e0.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
979  e0 = irbloc(lbl_df_0.name, [e0])
980 
981  e1 = []
982  e1.append(m2_expr.ExprAff(a.arg,
983  a.arg - m2_expr.ExprInt_from(a.arg, size / 8)))
984  e1.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
985  e1 = irbloc(lbl_df_1.name, [e1])
986 
987  e.append(m2_expr.ExprAff(ir.IRDst,
988  m2_expr.ExprCond(df, lbl_df_1, lbl_df_0)))
989 
990  return e, [e0, e1]
991 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.set_float_cs_eip (   instr)

Definition at line 159 of file sem.py.

160 def set_float_cs_eip(instr):
161  e = []
162  # XXX TODO check float updt
163  e.append(m2_expr.ExprAff(float_eip,
164  m2_expr.ExprInt_from(float_eip, instr.offset)))
165  e.append(m2_expr.ExprAff(float_cs, CS))
166  return e
def set_float_cs_eip
Definition: sem.py:159
def miasm2.arch.x86.sem.seta (   ir,
  instr,
  a 
)

Definition at line 785 of file sem.py.

786 def seta(ir, instr, a):
787  e = []
788  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(cf | zf,
789  m2_expr.ExprInt_from(a, 0),
790  m2_expr.ExprInt_from(a, 1))))
791 
792  return e, []
793 
def miasm2.arch.x86.sem.setae (   ir,
  instr,
  a 
)

Definition at line 794 of file sem.py.

795 def setae(ir, instr, a):
796  e = []
797  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(cf, m2_expr.ExprInt_from(a, 0),
798  m2_expr.ExprInt_from(a, 1))))
799  return e, []
800 
def miasm2.arch.x86.sem.setalc (   ir,
  instr 
)

Definition at line 893 of file sem.py.

894 def setalc(ir, instr):
895  a = mRAX[instr.mode][0:8]
896  e = []
897  e.append(
898  m2_expr.ExprAff(a, m2_expr.ExprCond(cf, m2_expr.ExprInt_from(a, 0xff),
899  m2_expr.ExprInt_from(a, 0))))
900  return e, []
901 
def miasm2.arch.x86.sem.setb (   ir,
  instr,
  a 
)

Definition at line 801 of file sem.py.

802 def setb(ir, instr, a):
803  e = []
804  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(cf, m2_expr.ExprInt_from(a, 1),
805  m2_expr.ExprInt_from(a, 0))))
806  return e, []
807 
def miasm2.arch.x86.sem.setbe (   ir,
  instr,
  a 
)

Definition at line 808 of file sem.py.

809 def setbe(ir, instr, a):
810  e = []
811  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(cf | zf,
812  m2_expr.ExprInt_from(a, 1),
813  m2_expr.ExprInt_from(a, 0)))
814  )
815  return e, []
816 
def miasm2.arch.x86.sem.sete (   ir,
  instr,
  a 
)

Definition at line 746 of file sem.py.

747 def sete(ir, instr, a):
748  e = []
749  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(zf, m2_expr.ExprInt_from(a, 1),
750  m2_expr.ExprInt_from(a, 0))))
751  return e, []
752 
def miasm2.arch.x86.sem.setg (   ir,
  instr,
  a 
)

Definition at line 768 of file sem.py.

769 def setg(ir, instr, a):
770  e = []
771  a0 = m2_expr.ExprInt_from(a, 0)
772  a1 = m2_expr.ExprInt_from(a, 1)
773  ret = m2_expr.ExprCond(zf, a0, a1) & m2_expr.ExprCond(nf - of, a0, a1)
774  e.append(m2_expr.ExprAff(a, ret))
775  return e, []
776 
def miasm2.arch.x86.sem.setge (   ir,
  instr,
  a 
)

Definition at line 777 of file sem.py.

778 def setge(ir, instr, a):
779  e = []
780  e.append(
781  m2_expr.ExprAff(a, m2_expr.ExprCond(nf - of, m2_expr.ExprInt_from(a, 0),
782  m2_expr.ExprInt_from(a, 1))))
783  return e, []
784 
def miasm2.arch.x86.sem.setl (   ir,
  instr,
  a 
)

Definition at line 760 of file sem.py.

761 def setl(ir, instr, a):
762  e = []
763  e.append(
764  m2_expr.ExprAff(a, m2_expr.ExprCond(nf - of, m2_expr.ExprInt_from(a, 1),
765  m2_expr.ExprInt_from(a, 0))))
766  return e, []
767 
def miasm2.arch.x86.sem.setle (   ir,
  instr,
  a 
)

Definition at line 852 of file sem.py.

853 def setle(ir, instr, a):
854  e = []
855  a0 = m2_expr.ExprInt_from(a, 0)
856  a1 = m2_expr.ExprInt_from(a, 1)
857  ret = m2_expr.ExprCond(zf, a1, a0) | m2_expr.ExprCond(nf ^ of, a1, a0)
858  e.append(m2_expr.ExprAff(a, ret))
859  return e, []
860 
def miasm2.arch.x86.sem.setna (   ir,
  instr,
  a 
)

Definition at line 861 of file sem.py.

862 def setna(ir, instr, a):
863  e = []
864  a0 = m2_expr.ExprInt_from(a, 0)
865  a1 = m2_expr.ExprInt_from(a, 1)
866  ret = m2_expr.ExprCond(cf, a1, a0) & m2_expr.ExprCond(zf, a1, a0)
867  e.append(m2_expr.ExprAff(a, ret))
868  return e, []
869 
def miasm2.arch.x86.sem.setnb (   ir,
  instr,
  a 
)

Definition at line 886 of file sem.py.

887 def setnb(ir, instr, a):
888  e = []
889  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(cf, m2_expr.ExprInt_from(a, 0),
890  m2_expr.ExprInt_from(a, 1))))
891  return e, []
892 
def miasm2.arch.x86.sem.setnbe (   ir,
  instr,
  a 
)

Definition at line 870 of file sem.py.

871 def setnbe(ir, instr, a):
872  e = []
873  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(cf | zf,
874  m2_expr.ExprInt_from(a, 0),
875  m2_expr.ExprInt_from(a, 1)))
876  )
877  return e, []
878 
def miasm2.arch.x86.sem.setno (   ir,
  instr,
  a 
)

Definition at line 879 of file sem.py.

880 def setno(ir, instr, a):
881  e = []
882  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(of, m2_expr.ExprInt_from(a, 0),
883  m2_expr.ExprInt_from(a, 1))))
884  return e, []
885 
def miasm2.arch.x86.sem.setnp (   ir,
  instr,
  a 
)

Definition at line 845 of file sem.py.

846 def setnp(ir, instr, a):
847  e = []
848  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(pf, m2_expr.ExprInt_from(a, 0),
849  m2_expr.ExprInt_from(a, 1))))
850  return e, []
851 
def miasm2.arch.x86.sem.setns (   ir,
  instr,
  a 
)

Definition at line 817 of file sem.py.

818 def setns(ir, instr, a):
819  e = []
820  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(nf, m2_expr.ExprInt_from(a, 0),
821  m2_expr.ExprInt_from(a, 1))))
822  return e, []
823 
def miasm2.arch.x86.sem.setnz (   ir,
  instr,
  a 
)

Definition at line 753 of file sem.py.

754 def setnz(ir, instr, a):
755  e = []
756  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(zf, m2_expr.ExprInt_from(a, 0),
757  m2_expr.ExprInt_from(a, 1))))
758  return e, []
759 
def miasm2.arch.x86.sem.seto (   ir,
  instr,
  a 
)

Definition at line 831 of file sem.py.

832 def seto(ir, instr, a):
833  e = []
834  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(of, m2_expr.ExprInt_from(a, 1),
835  m2_expr.ExprInt_from(a, 0))))
836  return e, []
837 
def miasm2.arch.x86.sem.setp (   ir,
  instr,
  a 
)

Definition at line 838 of file sem.py.

839 def setp(ir, instr, a):
840  e = []
841  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(pf, m2_expr.ExprInt_from(a, 1),
842  m2_expr.ExprInt_from(a, 0))))
843  return e, []
844 
def miasm2.arch.x86.sem.sets (   ir,
  instr,
  a 
)

Definition at line 824 of file sem.py.

825 def sets(ir, instr, a):
826  e = []
827  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(nf, m2_expr.ExprInt_from(a, 1),
828  m2_expr.ExprInt_from(a, 0))))
829  return e, []
830 
def miasm2.arch.x86.sem.shl (   ir,
  instr,
  a,
  b 
)

Definition at line 590 of file sem.py.

591 def shl(ir, instr, a, b):
592  e = []
593  shifter = get_shift(a, b)
594  c = a << shifter
595  new_cf = (a >> (m2_expr.ExprInt_from(a, a.size) - shifter))[:1]
596  e.append(m2_expr.ExprAff(cf, m2_expr.ExprCond(shifter,
597  new_cf,
598  cf)
599  )
600  )
601  e += update_flag_znp(c)
602  e.append(m2_expr.ExprAff(of, c.msb() ^ new_cf))
603  e.append(m2_expr.ExprAff(a, c))
604  return e, []
605 
def update_flag_znp
Definition: sem.py:83

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.shld (   ir,
  instr,
  a,
  b,
  c 
)

Definition at line 610 of file sem.py.

611 def shld(ir, instr, a, b, c):
612  e = []
613  shifter = c.zeroExtend(a.size) & m2_expr.ExprInt_from(a, 0x1f)
614  c = m2_expr.ExprOp('|',
615  a << shifter,
616  b >> (m2_expr.ExprInt_from(a, a.size) - shifter)
617  )
618 
619  new_cf = (a >> (m2_expr.ExprInt_from(a, a.size) - shifter))[:1]
620  e.append(m2_expr.ExprAff(cf, m2_expr.ExprCond(shifter,
621  new_cf,
622  cf)
623  )
624  )
625  # XXX todo: don't update flag if shifter is 0
626  e += update_flag_znp(c)
627  e.append(m2_expr.ExprAff(of, c.msb() ^ new_cf))
628  e.append(m2_expr.ExprAff(a, m2_expr.ExprCond(shifter,
629  c,
630  a)))
631  return e, []
632 
633 
# XXX todo ###
def update_flag_znp
Definition: sem.py:83

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.shld_cl (   ir,
  instr,
  a,
  b 
)

Definition at line 606 of file sem.py.

607 def shld_cl(ir, instr, a, b):
608  return shld(ir, instr, a, b, ecx)
609 

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.shr (   ir,
  instr,
  a,
  b 
)

Definition at line 506 of file sem.py.

507 def shr(ir, instr, a, b):
508 
509  shifter = get_shift(a, b)
510  c = m2_expr.ExprOp('>>', a, shifter)
511 
512  lbl_do = m2_expr.ExprId(ir.gen_label(), instr.mode)
513  lbl_skip = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
514 
515  new_cf = m2_expr.ExprOp('>>', a, (shifter - m2_expr.ExprInt_from(a, 1)))[:1]
516 
517  e_do = [
518  m2_expr.ExprAff(cf, new_cf),
519  m2_expr.ExprAff(of, m2_expr.ExprInt_from(of, 0)),
520  m2_expr.ExprAff(a, c),
521  ]
522 
523  e_do += update_flag_znp(c)
524 
525  # dont generate conditional shifter on constant
526  if isinstance(shifter, m2_expr.ExprInt):
527  if int(shifter.arg) != 0:
528  return e_do, []
529  else:
530  return [], []
531 
532  e_do.append(m2_expr.ExprAff(ir.IRDst, lbl_skip))
533 
534  e = []
535  e.append(m2_expr.ExprAff(ir.IRDst, m2_expr.ExprCond(shifter, lbl_do,
536  lbl_skip)))
537  return e, [irbloc(lbl_do.name, [e_do])]
538 
def update_flag_znp
Definition: sem.py:83

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.shrd (   ir,
  instr,
  a,
  b,
  c 
)

Definition at line 557 of file sem.py.

558 def shrd(ir, instr, a, b, c):
559  e = []
560  shifter = get_shift(a, c)
561 
562  d = (a >> shifter) | (b << (m2_expr.ExprInt_from(a, a.size) - shifter))
563  new_cf = (a >> (shifter - m2_expr.ExprInt_from(a, 1)))[:1]
564  e.append(m2_expr.ExprAff(cf, m2_expr.ExprCond(shifter,
565  new_cf,
566  cf)
567  )
568  )
569  e.append(m2_expr.ExprAff(of, a.msb()))
570  e += update_flag_znp(d)
571  e.append(m2_expr.ExprAff(a, d))
572  return e, []
573 
def update_flag_znp
Definition: sem.py:83

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.shrd_cl (   ir,
  instr,
  a,
  b 
)

Definition at line 539 of file sem.py.

540 def shrd_cl(ir, instr, a, b):
541  e = []
542  opmode, admode = s, instr.v_admode()
543  shifter = mRCX[instr.mode][:8].zeroExtend(a.size)
544  shifter &= m2_expr.ExprInt_from(a, 0x1f)
545  c = (a >> shifter) | (b << (m2_expr.ExprInt_from(a, a.size) - shifter))
546  new_cf = (a >> (shifter - m2_expr.ExprInt_from(a, 1)))[:1]
547  e.append(m2_expr.ExprAff(cf, m2_expr.ExprCond(shifter,
548  new_cf,
549  cf)
550  )
551  )
552  e.append(m2_expr.ExprAff(of, a.msb()))
553  e += update_flag_znp(c)
554  e.append(m2_expr.ExprAff(a, c))
555  return e, []
556 
def update_flag_znp
Definition: sem.py:83

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.sidt (   ir,
  instr,
  a 
)

Definition at line 2702 of file sem.py.

2703 def sidt(ir, instr, a):
2704  e = []
2705  if not isinstance(a, m2_expr.ExprMem) or a.size != 32:
2706  raise ValueError('not exprmem 32bit instance!!')
2707  b = a.arg
2708  print "DEFAULT SIDT ADDRESS %s!!" % str(a)
2709  e.append(m2_expr.ExprAff(m2_expr.ExprMem(b, 32),
2710  m2_expr.ExprInt32(0xe40007ff)))
2711  e.append(
2712  m2_expr.ExprAff(m2_expr.ExprMem(m2_expr.ExprOp("+", b,
2713  m2_expr.ExprInt_from(b, 4)), 16), m2_expr.ExprInt16(0x8245)))
2714  return e, []
2715 
def miasm2.arch.x86.sem.sldt (   ir,
  instr,
  a 
)

Definition at line 2716 of file sem.py.

2717 def sldt(ir, instr, a):
2718  # XXX TOOD
2719  e = [m2_expr.ExprAff(exception_flags, m2_expr.ExprInt32(EXCEPT_PRIV_INSN))]
2720  return e, []
2721 
def miasm2.arch.x86.sem.stc (   ir,
  instr 
)

Definition at line 645 of file sem.py.

646 def stc(ir, instr):
647  e = [m2_expr.ExprAff(cf, m2_expr.ExprInt_from(cf, 1))]
648  return e, []
649 
def miasm2.arch.x86.sem.std (   ir,
  instr 
)

Definition at line 655 of file sem.py.

656 def std(ir, instr):
657  e = [m2_expr.ExprAff(df, m2_expr.ExprInt_from(df, 1))]
658  return e, []
659 
def miasm2.arch.x86.sem.sti (   ir,
  instr 
)

Definition at line 665 of file sem.py.

666 def sti(ir, instr):
667  e = [m2_expr.ExprAff(exception_flags, m2_expr.ExprInt32(EXCEPT_PRIV_INSN))]
668  e = [] # XXX TODO HACK
669  return e, []
670 
def miasm2.arch.x86.sem.stos (   ir,
  instr,
  size 
)

Definition at line 1605 of file sem.py.

1606 def stos(ir, instr, size):
1607  lbl_df_0 = m2_expr.ExprId(ir.gen_label(), instr.mode)
1608  lbl_df_1 = m2_expr.ExprId(ir.gen_label(), instr.mode)
1609  lbl_next = m2_expr.ExprId(ir.get_next_label(instr), instr.mode)
1610 
1611  s = instr.v_admode()
1612 
1613  addr_o = mRDI[instr.mode][:s]
1614  addr = addr_o
1615  addr_p = addr + m2_expr.ExprInt_from(addr, size / 8)
1616  addr_m = addr - m2_expr.ExprInt_from(addr, size / 8)
1617  if ir.do_str_segm:
1618  mss = ES
1619  if instr.additional_info.g2.value:
1620  raise NotImplementedError("add segm support")
1621  addr = m2_expr.ExprOp('segm', mss, addr)
1622 
1623  b = mRAX[instr.mode][:size]
1624 
1625  e0 = []
1626  e0.append(m2_expr.ExprAff(addr_o, addr_p))
1627  e0.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
1628  e0 = irbloc(lbl_df_0.name, [e0])
1629 
1630  e1 = []
1631  e1.append(m2_expr.ExprAff(addr_o, addr_m))
1632  e1.append(m2_expr.ExprAff(ir.IRDst, lbl_next))
1633  e1 = irbloc(lbl_df_1.name, [e1])
1634 
1635  e = []
1636  e.append(m2_expr.ExprAff(m2_expr.ExprMem(addr, size), b))
1637  e.append(m2_expr.ExprAff(ir.IRDst,
1638  m2_expr.ExprCond(df, lbl_df_1, lbl_df_0)))
1639  return e, [e0, e1]
1640 
def miasm2.arch.x86.sem.sub (   ir,
  instr,
  a,
  b 
)

Definition at line 320 of file sem.py.

321 def sub(ir, instr, a, b):
322  e = []
323  c = a - b
324  e += update_flag_arith(c)
325  e += update_flag_af(c)
326  e += update_flag_sub(a, b, c)
327  e.append(m2_expr.ExprAff(a, c))
328  return e, []
329 
330 # a-(b+cf)
331 
def update_flag_sub
Definition: sem.py:152
def update_flag_arith
Definition: sem.py:99
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.ucomiss (   ir,
  instr,
  a,
  b 
)

Definition at line 3381 of file sem.py.

3382 def ucomiss(ir, instr, a, b):
3383  e = []
3384  e.append(m2_expr.ExprAff(zf, m2_expr.ExprOp('ucomiss_zf', a[:32], b[:32])))
3385  e.append(m2_expr.ExprAff(pf, m2_expr.ExprOp('ucomiss_pf', a[:32], b[:32])))
3386  e.append(m2_expr.ExprAff(cf, m2_expr.ExprOp('ucomiss_cf', a[:32], b[:32])))
3387 
3388  e.append(m2_expr.ExprAff(of, m2_expr.ExprInt1(0)))
3389  e.append(m2_expr.ExprAff(af, m2_expr.ExprInt1(0)))
3390  e.append(m2_expr.ExprAff(nf, m2_expr.ExprInt1(0)))
3391 
3392  return e, []
def miasm2.arch.x86.sem.update_flag_add (   x,
  y,
  z 
)

Definition at line 143 of file sem.py.

144 def update_flag_add(x, y, z):
145  e = []
146  e.append(update_flag_add_cf(x, y, z))
147  e.append(update_flag_add_of(x, y, z))
148  return e
149 
150 # z = x-y (+cf?)
151 
def update_flag_add_cf
Definition: sem.py:118
def update_flag_add
Definition: sem.py:143
def update_flag_add_of
Definition: sem.py:124

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_add_cf (   op1,
  op2,
  res 
)

Definition at line 118 of file sem.py.

119 def update_flag_add_cf(op1, op2, res):
120  "Compute cf in @res = @op1 + @op2"
121  ret = (((op1 ^ op2) ^ res) ^ ((op1 ^ res) & (~(op1 ^ op2)))).msb()
122  return m2_expr.ExprAff(cf, ret)
123 
def update_flag_add_cf
Definition: sem.py:118

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_add_of (   op1,
  op2,
  res 
)

Definition at line 124 of file sem.py.

125 def update_flag_add_of(op1, op2, res):
126  "Compute of in @res = @op1 + @op2"
127  return m2_expr.ExprAff(of, (((op1 ^ res) & (~(op1 ^ op2)))).msb())
128 
129 
# checked: ok for sbb add because b & c before +cf
def update_flag_add_of
Definition: sem.py:124

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_af (   a)

Definition at line 76 of file sem.py.

76 
77 def update_flag_af(a):
78  return [m2_expr.ExprAff(af,
79  m2_expr.ExprCond((a & m2_expr.ExprInt_from(a,0x10)),
80  m2_expr.ExprInt_from(af, 1),
81  m2_expr.ExprInt_from(af, 0)))]
82 
def update_flag_af
Definition: sem.py:76

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_arith (   a)

Definition at line 99 of file sem.py.

99 
100 def update_flag_arith(a):
101  e = []
102  e += update_flag_znp(a)
103  return e
104 
def update_flag_znp
Definition: sem.py:83
def update_flag_arith
Definition: sem.py:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_logic (   a)

Definition at line 91 of file sem.py.

91 
92 def update_flag_logic(a):
93  e = []
94  e += update_flag_znp(a)
95  e.append(m2_expr.ExprAff(of, m2_expr.ExprInt_from(of, 0)))
96  e.append(m2_expr.ExprAff(cf, m2_expr.ExprInt_from(cf, 0)))
97  return e
98 
def update_flag_logic
Definition: sem.py:91
def update_flag_znp
Definition: sem.py:83

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_nf (   a)

Definition at line 66 of file sem.py.

66 
67 def update_flag_nf(a):
68  return [m2_expr.ExprAff(nf, a.msb())]
69 
def update_flag_nf
Definition: sem.py:66

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_pf (   a)

Definition at line 70 of file sem.py.

70 
71 def update_flag_pf(a):
72  return [m2_expr.ExprAff(pf,
73  m2_expr.ExprOp('parity',
74  a & m2_expr.ExprInt_from(a, 0xFF)))]
75 
def update_flag_pf
Definition: sem.py:70

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_sub (   x,
  y,
  z 
)

Definition at line 152 of file sem.py.

153 def update_flag_sub(x, y, z):
154  e = []
155  e.append(update_flag_sub_cf(x, y, z))
156  e.append(update_flag_sub_of(x, y, z))
157  return e
158 
def update_flag_sub_cf
Definition: sem.py:130
def update_flag_sub_of
Definition: sem.py:136
def update_flag_sub
Definition: sem.py:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_sub_cf (   op1,
  op2,
  res 
)

Definition at line 130 of file sem.py.

131 def update_flag_sub_cf(op1, op2, res):
132  "Compote CF in @res = @op1 - @op2"
133  ret = (((op1 ^ op2) ^ res) ^ ((op1 ^ res) & (op1 ^ op2))).msb()
134  return m2_expr.ExprAff(cf, ret)
135 
def update_flag_sub_cf
Definition: sem.py:130

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_sub_of (   op1,
  op2,
  res 
)

Definition at line 136 of file sem.py.

137 def update_flag_sub_of(op1, op2, res):
138  "Compote OF in @res = @op1 - @op2"
139  return m2_expr.ExprAff(of, (((op1 ^ res) & (op1 ^ op2))).msb())
140 
141 # z = x+y (+cf?)
142 
def update_flag_sub_of
Definition: sem.py:136

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_zf (   a)

Definition at line 61 of file sem.py.

61 
62 def update_flag_zf(a):
63  return [m2_expr.ExprAff(zf, m2_expr.ExprCond(a, m2_expr.ExprInt_from(zf, 0),
64  m2_expr.ExprInt_from(zf, 1)))]
65 
def update_flag_zf
Definition: sem.py:61

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.update_flag_znp (   a)

Definition at line 83 of file sem.py.

83 
84 def update_flag_znp(a):
85  e = []
86  e += update_flag_zf(a)
87  e += update_flag_nf(a)
88  e += update_flag_pf(a)
89  return e
90 
def update_flag_pf
Definition: sem.py:70
def update_flag_nf
Definition: sem.py:66
def update_flag_znp
Definition: sem.py:83
def update_flag_zf
Definition: sem.py:61

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.sem.vec_op_clip (   op,
  size 
)

MMX/SSE/AVX operations.

Generate simd operations
@op: the operator
@size: size of an element

Definition at line 3103 of file sem.py.

3104 def vec_op_clip(op, size):
3105  """
3106  Generate simd operations
3107  @op: the operator
3108  @size: size of an element
3109  """
3110  def vec_op_clip_instr(ir, instr, a, b):
3111  if op == '-':
3112  return [m2_expr.ExprAff(a[:size], a[:size] - b[:size])], []
3113  else:
3114  return [m2_expr.ExprAff(a[:size], m2_expr.ExprOp(op, a[:size], b[:size]))], []
3115  return vec_op_clip_instr
3116 
# Generic vertical operation
def vec_op_clip
MMX/SSE/AVX operations.
Definition: sem.py:3103
def miasm2.arch.x86.sem.vec_vertical_instr (   op,
  elt_size 
)

Definition at line 3161 of file sem.py.

3162 def vec_vertical_instr(op, elt_size):
3163  return __vec_vertical_instr_gen(op, elt_size, vec_vertical_sem)
def __vec_vertical_instr_gen
Definition: sem.py:3151
def vec_vertical_instr
Definition: sem.py:3161

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.vec_vertical_sem (   op,
  elt_size,
  reg_size,
  a,
  b 
)

Definition at line 3117 of file sem.py.

3118 def vec_vertical_sem(op, elt_size, reg_size, a, b):
3119  assert(reg_size % elt_size == 0)
3120  n = reg_size/elt_size
3121  if op == '-':
3122  ops = [((a[i*elt_size:(i+1)*elt_size] - b[i*elt_size:(i+1)*elt_size]),
3123  i*elt_size, (i+1)*elt_size) for i in xrange(0, n)]
3124  else:
3125  ops = [(m2_expr.ExprOp(op, a[i*elt_size:(i+1)*elt_size],
3126  b[i*elt_size:(i+1)*elt_size]),
3127  i*elt_size,
3128  (i+1)*elt_size) for i in xrange(0, n)]
3129 
3130  return m2_expr.ExprCompose(ops)
def vec_vertical_sem
Definition: sem.py:3117
def miasm2.arch.x86.sem.wrmsr (   ir,
  instr 
)

Definition at line 3092 of file sem.py.

3093 def wrmsr(ir, instr):
3094  msr_addr = m2_expr.ExprId('MSR') + m2_expr.ExprInt32(8) * mRCX[instr.mode][:32]
3095  e = []
3096  src = m2_expr.ExprCompose([(mRAX[instr.mode][:32], 0, 32),
3097  (mRDX[instr.mode][:32], 32, 64)])
3098  e.append(m2_expr.ExprAff(m2_expr.ExprMem(msr_addr, 64), src))
3099  return e, []
def miasm2.arch.x86.sem.xadd (   ir,
  instr,
  a,
  b 
)

Definition at line 297 of file sem.py.

298 def xadd(ir, instr, a, b):
299  e = []
300  c = a + b
301  e += update_flag_arith(c)
302  e += update_flag_af(c)
303  e += update_flag_add(b, a, c)
304  e.append(m2_expr.ExprAff(b, a))
305  e.append(m2_expr.ExprAff(a, c))
306  return e, []
307 
def update_flag_add
Definition: sem.py:143
def update_flag_arith
Definition: sem.py:99
def update_flag_af
Definition: sem.py:76

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.xchg (   ir,
  instr,
  a,
  b 
)

Definition at line 263 of file sem.py.

264 def xchg(ir, instr, a, b):
265  e = []
266  e.append(m2_expr.ExprAff(a, b))
267  e.append(m2_expr.ExprAff(b, a))
268  return e, []
269 
def miasm2.arch.x86.sem.xlat (   ir,
  instr 
)

Definition at line 2832 of file sem.py.

2833 def xlat(ir, instr):
2834  e = []
2835  a = m2_expr.ExprCompose([(m2_expr.ExprInt(0, 24), 8, 32),
2836  (mRAX[instr.mode][0:8], 0, 8)])
2837  b = m2_expr.ExprMem(m2_expr.ExprOp('+', mRBX[instr.mode], a), 8)
2838  e.append(m2_expr.ExprAff(mRAX[instr.mode][0:8], b))
2839  return e, []
2840 
def miasm2.arch.x86.sem.xor (   ir,
  instr,
  a,
  b 
)

Definition at line 372 of file sem.py.

373 def xor(ir, instr, a, b):
374  e = []
375  c = a ^ b
376  e += update_flag_logic(c)
377  e.append(m2_expr.ExprAff(a, c))
378  return e, []
379 
def update_flag_logic
Definition: sem.py:91

+ Here is the call graph for this function:

def miasm2.arch.x86.sem.xorps (   ir,
  instr,
  a,
  b 
)

Definition at line 3079 of file sem.py.

3080 def xorps(ir, instr, a, b):
3081  e = []
3082  e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('^', a, b)))
3083  return e, []
3084 

Variable Documentation

tuple miasm2.arch.x86.sem.addpd = float_vec_vertical_instr('+', 64)

Definition at line 3195 of file sem.py.

tuple miasm2.arch.x86.sem.addps = float_vec_vertical_instr('+', 32)

Definition at line 3194 of file sem.py.

tuple miasm2.arch.x86.sem.addsd = vec_op_clip('+', 64)

Definition at line 3193 of file sem.py.

tuple miasm2.arch.x86.sem.addss = vec_op_clip('+', 32)

Floating-point arithmetic.

Definition at line 3192 of file sem.py.

tuple miasm2.arch.x86.sem.divpd = float_vec_vertical_instr('/', 64)

Definition at line 3207 of file sem.py.

tuple miasm2.arch.x86.sem.divps = float_vec_vertical_instr('/', 32)

Definition at line 3206 of file sem.py.

tuple miasm2.arch.x86.sem.divsd = vec_op_clip('/', 64)

Definition at line 3205 of file sem.py.

tuple miasm2.arch.x86.sem.divss = vec_op_clip('/', 32)

Definition at line 3204 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_ACCESS_VIOL = (1 << 14)

Definition at line 39 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_BREAKPOINT_INTERN = (1 << 10)

Definition at line 32 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_ILLEGAL_INSN = (1 << 18)

Definition at line 42 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_INT_DIV_BY_ZERO = (1 << 16)

Definition at line 40 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_INT_XX = (1 << 2)

Definition at line 30 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_NUM_UPDT_EIP = (1 << 11)

Definition at line 34 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_PRIV_INSN = (1 << 17)

Definition at line 41 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_SOFT_BP = (1 << 1)

Definition at line 29 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_THROW_SEH = (1 << 13)

Definition at line 37 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_UNK_EIP = (1 << 14)

Definition at line 38 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_UNK_MEM_AD = (1 << 12)

Definition at line 36 of file sem.py.

tuple miasm2.arch.x86.sem.EXCEPT_UNK_MNEMO = (1 << 19)

Definition at line 43 of file sem.py.

dictionary miasm2.arch.x86.sem.mnemo_func

Definition at line 3393 of file sem.py.

tuple miasm2.arch.x86.sem.mulpd = float_vec_vertical_instr('*', 64)

Definition at line 3203 of file sem.py.

tuple miasm2.arch.x86.sem.mulps = float_vec_vertical_instr('*', 32)

Definition at line 3202 of file sem.py.

tuple miasm2.arch.x86.sem.mulsd = vec_op_clip('*', 64)

Definition at line 3201 of file sem.py.

tuple miasm2.arch.x86.sem.mulss = vec_op_clip('*', 32)

Definition at line 3200 of file sem.py.

tuple miasm2.arch.x86.sem.paddb = vec_vertical_instr('+', 8)

Integer arithmetic.

Additions

Definition at line 3174 of file sem.py.

tuple miasm2.arch.x86.sem.paddd = vec_vertical_instr('+', 32)

Definition at line 3176 of file sem.py.

tuple miasm2.arch.x86.sem.paddq = vec_vertical_instr('+', 64)

Definition at line 3177 of file sem.py.

tuple miasm2.arch.x86.sem.paddw = vec_vertical_instr('+', 16)

Definition at line 3175 of file sem.py.

tuple miasm2.arch.x86.sem.psubb = vec_vertical_instr('-', 8)

Substractions.

Definition at line 3183 of file sem.py.

tuple miasm2.arch.x86.sem.psubd = vec_vertical_instr('-', 32)

Definition at line 3185 of file sem.py.

tuple miasm2.arch.x86.sem.psubq = vec_vertical_instr('-', 64)

Definition at line 3186 of file sem.py.

tuple miasm2.arch.x86.sem.psubw = vec_vertical_instr('-', 16)

Definition at line 3184 of file sem.py.

tuple miasm2.arch.x86.sem.subpd = float_vec_vertical_instr('-', 64)

Definition at line 3199 of file sem.py.

tuple miasm2.arch.x86.sem.subps = float_vec_vertical_instr('-', 32)

Definition at line 3198 of file sem.py.

tuple miasm2.arch.x86.sem.subsd = vec_op_clip('-', 64)

Definition at line 3197 of file sem.py.

tuple miasm2.arch.x86.sem.subss = vec_op_clip('-', 32)

Definition at line 3196 of file sem.py.