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

Classes

class  arminfo
 
class  ir_armb
 
class  ir_arml
 
class  ir_armtb
 
class  ir_armtl
 

Functions

def update_flag_zf
 
def update_flag_nf
 
def update_flag_zn
 
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 get_dst
 
def adc
 
def add
 
def l_and
 
def sub
 
def subs
 
def eor
 
def eors
 
def rsb
 
def rsbs
 
def sbc
 
def sbcs
 
def rsc
 
def rscs
 
def tst
 
def teq
 
def l_cmp
 
def cmn
 
def orr
 
def orrs
 
def mov
 
def movt
 
def movs
 
def mvn
 
def mvns
 
def neg
 
def negs
 
def bic
 
def bics
 
def mla
 
def mlas
 
def mul
 
def muls
 
def umull
 
def umlal
 
def smull
 
def smlal
 
def b
 
def bl
 
def bx
 
def blx
 
def st_ld_r
 
def ldr
 
def ldrd
 
def l_str
 
def l_strd
 
def ldrb
 
def ldrsb
 
def strb
 
def ldrh
 
def strh
 
def ldrsh
 
def st_ld_m
 
def ldmia
 
def ldmib
 
def ldmda
 
def ldmdb
 
def stmia
 
def stmib
 
def stmda
 
def stmdb
 
def svc
 
def und
 
def lsr
 
def lsrs
 
def asr
 
def asrs
 
def lsl
 
def lsls
 
def push
 
def pop
 
def cbz
 
def cbnz
 
def uxtb
 
def uxth
 
def sxtb
 
def sxth
 
def ubfx
 
def bfc
 
def rev
 
def is_pc_written
 
def add_condition_expr
 
def split_expr_dst
 
def get_mnemo_expr
 

Variables

tuple EXCEPT_PRIV_INSN = (1 << 17)
 
int COND_EQ = 0
 
int COND_NE = 1
 
int COND_CS = 2
 
int COND_CC = 3
 
int COND_MI = 4
 
int COND_PL = 5
 
int COND_VS = 6
 
int COND_VC = 7
 
int COND_HI = 8
 
int COND_LS = 9
 
int COND_GE = 10
 
int COND_LT = 11
 
int COND_GT = 12
 
int COND_LE = 13
 
int COND_AL = 14
 
int COND_NV = 15
 
dictionary cond_dct
 
dictionary tab_cond
 
dictionary mnemo_func = {}
 
dictionary mnemo_func_cond = {}
 
dictionary mnemo_condm0
 
dictionary mnemo_condm1
 
dictionary mnemo_condm2
 
dictionary mnemo_nocond
 
list mn_cond_x
 
string cn = ""
 
 mn_mod = mn+cn
 
 get_arm_instr_expr = get_mnemo_expr
 

Function Documentation

def miasm2.arch.arm.sem.adc (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 104 of file sem.py.

105 def adc(ir, instr, a, b, c=None):
106  e = []
107  if c is None:
108  b, c = a, b
109  r = b + c + cf.zeroExtend(32)
110  if instr.name == 'ADCS' and a != PC:
111  e += update_flag_arith(r)
112  e += update_flag_add(b, c, r)
113  e.append(ExprAff(a, r))
114  dst = get_dst(a)
115  if dst is not None:
116  e.append(ExprAff(ir.IRDst, r))
117  return e
118 
def update_flag_add
Definition: sem.py:80
def update_flag_arith
Definition: sem.py:37

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.add (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 119 of file sem.py.

120 def add(ir, instr, a, b, c=None):
121  e = []
122  if c is None:
123  b, c = a, b
124  r = b + c
125  if instr.name == 'ADDS' and a != PC:
126  e += update_flag_arith(r)
127  e += update_flag_add(b, c, r)
128  e.append(ExprAff(a, r))
129  dst = get_dst(a)
130  if dst is not None:
131  e.append(ExprAff(ir.IRDst, r))
132  return e
133 
def update_flag_add
Definition: sem.py:80
def update_flag_arith
Definition: sem.py:37

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.add_condition_expr (   ir,
  instr,
  cond,
  instr_ir 
)

Definition at line 1008 of file sem.py.

1009 def add_condition_expr(ir, instr, cond, instr_ir):
1010  if cond == COND_AL:
1011  return instr_ir, []
1012  if not cond in tab_cond:
1013  raise ValueError('unknown condition %r' % cond)
1014  cond = tab_cond[cond]
1015 
1016  lbl_next = ExprId(ir.get_next_label(instr), 32)
1017  lbl_do = ExprId(ir.gen_label(), 32)
1018 
1019  dst_cond = ExprCond(cond, lbl_do, lbl_next)
1020  assert(isinstance(instr_ir, list))
1021 
1022  has_irdst = False
1023  for e in instr_ir:
1024  if e.dst == ir.IRDst:
1025  has_irdst = True
1026  break
1027  if not has_irdst:
1028  instr_ir.append(ExprAff(ir.IRDst, lbl_next))
1029  e_do = irbloc(lbl_do.name, [instr_ir])
1030  e = [ExprAff(ir.IRDst, dst_cond)]
1031  return e, [e_do]
def add_condition_expr
Definition: sem.py:1008

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.arith_flag (   a,
  b,
  c 
)

Definition at line 48 of file sem.py.

48 
49 def arith_flag(a, b, c):
50  a_s, b_s, c_s = a.size, b.size, c.size
51  check_ops_msb(a_s, b_s, c_s)
52  a_s, b_s, c_s = a.msb(), b.msb(), c.msb()
53  return a_s, b_s, c_s
54 
55 # checked: ok for adc add because b & c before +cf
def check_ops_msb
Definition: sem.py:43
def arith_flag
Definition: sem.py:48

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.asr (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 762 of file sem.py.

763 def asr(ir, instr, a, b, c=None):
764  e = []
765  if c is None:
766  b, c = a, b
767  r = ExprOp("a>>", b, c)
768  e.append(ExprAff(a, r))
769  dst = get_dst(a)
770  if dst is not None:
771  e.append(ExprAff(ir.IRDst, r))
772  return e

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.asrs (   ir,
  instr,
  a,
  b,
  c 
)

Definition at line 773 of file sem.py.

774 def asrs(ir, instr, a, b, c):
775  e = []
776  if c is None:
777  b, c = a, b
778  r = ExprOp("a>>", b, c)
779  e.append(ExprAff(a, r))
780  e += update_flag_logic(r)
781  dst = get_dst(a)
782  if dst is not None:
783  e.append(ExprAff(ir.IRDst, r))
784  return e
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

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

Definition at line 505 of file sem.py.

506 def b(ir, instr, a):
507  e = []
508  e.append(ExprAff(PC, a))
509  e.append(ExprAff(ir.IRDst, a))
510  return e
511 
def miasm2.arch.arm.sem.bfc (   ir,
  instr,
  a,
  b,
  c 
)

Definition at line 905 of file sem.py.

906 def bfc(ir, instr, a, b, c):
907  e = []
908  start = int(b.arg)
909  stop = start + int(c.arg)
910  out = []
911  last = 0
912  if start:
913  out.append((a[:start], 0, start))
914  last = start
915  if stop - start:
916  out.append((ExprInt32(0)[last:stop], last, stop))
917  last = stop
918  if last < 32:
919  out.append((a[last:], last, 32))
920  r = ExprCompose(out)
921  e.append(ExprAff(a, r))
922  dst = None
923  if PC in a.get_r():
924  dst = PC
925  e.append(ExprAff(ir.IRDst, r))
926  return e

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.bic (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 403 of file sem.py.

404 def bic(ir, instr, a, b, c=None):
405  e = []
406  if c is None:
407  b, c = a, b
408  r = b & (c ^ ExprInt(uint32(-1)))
409  e.append(ExprAff(a, r))
410  dst = get_dst(a)
411  if dst is not None:
412  e.append(ExprAff(ir.IRDst, r))
413  return e
414 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.bics (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 415 of file sem.py.

416 def bics(ir, instr, a, b, c=None):
417  e = []
418  if c is None:
419  b, c = a, b
420  r = b & (c ^ ExprInt(uint32(-1)))
421  e += update_flag_logic(r)
422  e.append(ExprAff(a, r))
423  dst = get_dst(a)
424  if dst is not None:
425  e.append(ExprAff(ir.IRDst, r))
426  return e
427 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.bl (   ir,
  instr,
  a 
)

Definition at line 512 of file sem.py.

513 def bl(ir, instr, a):
514  e = []
515  l = ExprInt32(instr.offset + instr.l)
516  e.append(ExprAff(PC, a))
517  e.append(ExprAff(ir.IRDst, a))
518  e.append(ExprAff(LR, l))
519  return e
520 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.blx (   ir,
  instr,
  a 
)

Definition at line 528 of file sem.py.

529 def blx(ir, instr, a):
530  e = []
531  l = ExprInt32(instr.offset + instr.l)
532  e.append(ExprAff(PC, a))
533  e.append(ExprAff(ir.IRDst, a))
534  e.append(ExprAff(LR, l))
535  return e
536 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.bx (   ir,
  instr,
  a 
)

Definition at line 521 of file sem.py.

522 def bx(ir, instr, a):
523  e = []
524  e.append(ExprAff(PC, a))
525  e.append(ExprAff(ir.IRDst, a))
526  return e
527 
def miasm2.arch.arm.sem.cbnz (   ir,
  instr,
  a,
  b 
)

Definition at line 844 of file sem.py.

845 def cbnz(ir, instr, a, b):
846  e = []
847  lbl_next = ExprId(ir.get_next_label(instr), 32)
848  e.append(ir.IRDst, ExprCond(a, b, lbl_next))
849  return e
850 
851 
def miasm2.arch.arm.sem.cbz (   ir,
  instr,
  a,
  b 
)

Definition at line 837 of file sem.py.

838 def cbz(ir, instr, a, b):
839  e = []
840  lbl_next = ExprId(ir.get_next_label(instr), 32)
841  e.append(ExprAff(ir.IRDst, ExprCond(a, lbl_next, b)))
842  return e
843 
def miasm2.arch.arm.sem.check_ops_msb (   a,
  b,
  c 
)

Definition at line 43 of file sem.py.

43 
44 def check_ops_msb(a, b, c):
45  if not a or not b or not c or a != b or a != c:
46  raise ValueError('bad ops size %s %s %s' % (a, b, c))
47 
def check_ops_msb
Definition: sem.py:43

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.cmn (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 306 of file sem.py.

307 def cmn(ir, instr, a, b, c=None):
308  e = []
309  if c is None:
310  b, c = a, b
311  r = b + c
312  e += update_flag_arith(r)
313  e += update_flag_add(b, c, r)
314  return e
315 
def update_flag_add
Definition: sem.py:80
def update_flag_arith
Definition: sem.py:37

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.eor (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 174 of file sem.py.

175 def eor(ir, instr, a, b, c=None):
176  e = []
177  if c is None:
178  b, c = a, b
179  r = b ^ c
180  e.append(ExprAff(a, r))
181  dst = get_dst(a)
182  if dst is not None:
183  e.append(ExprAff(ir.IRDst, r))
184  return e
185 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.eors (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 186 of file sem.py.

187 def eors(ir, instr, a, b, c=None):
188  e = []
189  if c is None:
190  b, c = a, b
191  r = b ^ c
192  e += update_flag_logic(r)
193  e.append(ExprAff(a, r))
194  dst = get_dst(a)
195  if dst is not None:
196  e.append(ExprAff(ir.IRDst, r))
197  return e
198 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.get_dst (   a)

Definition at line 96 of file sem.py.

96 
97 def get_dst(a):
98  if a == PC:
99  return PC
100  return None
101 
102 # instruction definition ##############
103 

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.get_mnemo_expr (   ir,
  instr,
  args 
)

Definition at line 1174 of file sem.py.

1175 def get_mnemo_expr(ir, instr, *args):
1176  if not instr.name.lower() in mnemo_func_cond:
1177  raise ValueError('unknown mnemo %s' % instr)
1178  cond, mf = mnemo_func_cond[instr.name.lower()]
1179  instr_ir = mf(ir, instr, *args)
1180  instr, extra_ir = add_condition_expr(ir, instr, cond, instr_ir)
1181  return instr, extra_ir
def add_condition_expr
Definition: sem.py:1008
def get_mnemo_expr
Definition: sem.py:1174

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.is_pc_written (   ir,
  instr_ir 
)

Definition at line 1000 of file sem.py.

1001 def is_pc_written(ir, instr_ir):
1002  all_pc = ir.mn.pc.values()
1003  for ir in instr_ir:
1004  if ir.dst in all_pc:
1005  return True, ir.dst
1006  return False, None
1007 
def miasm2.arch.arm.sem.l_and (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 134 of file sem.py.

135 def l_and(ir, instr, a, b, c=None):
136  e = []
137  if c is None:
138  b, c = a, b
139  r = b & c
140  if instr.name == 'ANDS' and a != PC:
141  e += update_flag_logic(r)
142  e.append(ExprAff(a, r))
143  dst = get_dst(a)
144  if dst is not None:
145  e.append(ExprAff(ir.IRDst, r))
146  return e
147 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.l_cmp (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 296 of file sem.py.

297 def l_cmp(ir, instr, a, b, c=None):
298  e = []
299  if c is None:
300  b, c = a, b
301  r = b - c
302  e += update_flag_arith(r)
303  e += update_flag_sub(b, c, r)
304  return e
305 
def update_flag_arith
Definition: sem.py:37
def update_flag_sub
Definition: sem.py:89

+ Here is the call graph for this function:

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

Definition at line 610 of file sem.py.

611 def l_str(ir, instr, a, b):
612  return st_ld_r(ir, instr, a, b, store=True)
613 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.l_strd (   ir,
  instr,
  a,
  b 
)

Definition at line 614 of file sem.py.

615 def l_strd(ir, instr, a, b):
616  e = st_ld_r(ir, instr, a, b, store=True, size=64)
617  return e
618 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldmda (   ir,
  instr,
  a,
  b 
)

Definition at line 701 of file sem.py.

702 def ldmda(ir, instr, a, b):
703  return st_ld_m(ir, instr, a, b, store=False, postinc=True, updown=False)
704 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldmdb (   ir,
  instr,
  a,
  b 
)

Definition at line 705 of file sem.py.

706 def ldmdb(ir, instr, a, b):
707  return st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=False)
708 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldmia (   ir,
  instr,
  a,
  b 
)

Definition at line 693 of file sem.py.

694 def ldmia(ir, instr, a, b):
695  return st_ld_m(ir, instr, a, b, store=False, postinc=True, updown=True)
696 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldmib (   ir,
  instr,
  a,
  b 
)

Definition at line 697 of file sem.py.

698 def ldmib(ir, instr, a, b):
699  return st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=True)
700 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldr (   ir,
  instr,
  a,
  b 
)

Definition at line 601 of file sem.py.

602 def ldr(ir, instr, a, b):
603  return st_ld_r(ir, instr, a, b, store=False)
604 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldrb (   ir,
  instr,
  a,
  b 
)

Definition at line 619 of file sem.py.

620 def ldrb(ir, instr, a, b):
621  e = st_ld_r(ir, instr, a, b, store=False, size=8, z_ext=True)
622  return e

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldrd (   ir,
  instr,
  a,
  b 
)

Definition at line 605 of file sem.py.

606 def ldrd(ir, instr, a, b):
607  e = st_ld_r(ir, instr, a, b, store=False, size=64)
608  return e
609 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldrh (   ir,
  instr,
  a,
  b 
)

Definition at line 633 of file sem.py.

634 def ldrh(ir, instr, a, b):
635  e = st_ld_r(ir, instr, a, b, store=False, size=16, z_ext=True)
636  return e
637 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldrsb (   ir,
  instr,
  a,
  b 
)

Definition at line 623 of file sem.py.

624 def ldrsb(ir, instr, a, b):
625  e = st_ld_r(
626  ir, instr, a, b, store=False, size=8, s_ext=True, z_ext=False)
627  return e

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ldrsh (   ir,
  instr,
  a,
  b 
)

Definition at line 643 of file sem.py.

644 def ldrsh(ir, instr, a, b):
645  e = st_ld_r(
646  ir, instr, a, b, store=False, size=16, s_ext=True, z_ext=False)
647  return e
648 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.lsl (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 785 of file sem.py.

786 def lsl(ir, instr, a, b, c = None):
787  e = []
788  if c is None:
789  b, c = a, b
790  r = b << c
791  e.append(ExprAff(a, r))
792  dst = get_dst(a)
793  if dst is not None:
794  e.append(ExprAff(ir.IRDst, r))
795  return e
796 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.lsls (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 797 of file sem.py.

798 def lsls(ir, instr, a, b, c = None):
799  e = []
800  if c is None:
801  b, c = a, b
802  r = b << c
803  e.append(ExprAff(a, r))
804  e += update_flag_logic(r)
805  dst = get_dst(a)
806  if dst is not None:
807  e.append(ExprAff(ir.IRDst, r))
808  return e
809 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.lsr (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 738 of file sem.py.

739 def lsr(ir, instr, a, b, c = None):
740  e = []
741  if c is None:
742  b, c = a, b
743  r = b >> c
744  e.append(ExprAff(a, r))
745  dst = get_dst(a)
746  if dst is not None:
747  e.append(ExprAff(ir.IRDst, r))
748  return e
749 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.lsrs (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 750 of file sem.py.

751 def lsrs(ir, instr, a, b, c = None):
752  e = []
753  if c is None:
754  b, c = a, b
755  r = b >> c
756  e.append(ExprAff(a, r))
757  e += update_flag_logic(r)
758  dst = get_dst(a)
759  if dst is not None:
760  e.append(ExprAff(ir.IRDst, r))
761  return e
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.mla (   ir,
  instr,
  a,
  b,
  c,
  d 
)

Definition at line 428 of file sem.py.

429 def mla(ir, instr, a, b, c, d):
430  e = []
431  r = (b * c) + d
432  e.append(ExprAff(a, r))
433  dst = get_dst(a)
434  if dst is not None:
435  e.append(ExprAff(ir.IRDst, r))
436  return e
437 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.mlas (   ir,
  instr,
  a,
  b,
  c,
  d 
)

Definition at line 438 of file sem.py.

439 def mlas(ir, instr, a, b, c, d):
440  e = []
441  r = (b * c) + d
442  e += update_flag_zn(r)
443  e.append(ExprAff(a, r))
444  dst = get_dst(a)
445  if dst is not None:
446  e.append(ExprAff(ir.IRDst, r))
447  return e
448 
def update_flag_zn
Definition: sem.py:22

+ Here is the call graph for this function:

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

Definition at line 341 of file sem.py.

342 def mov(ir, instr, a, b):
343  e = [ExprAff(a, b)]
344  dst = get_dst(a)
345  if dst is not None:
346  e.append(ExprAff(ir.IRDst, b))
347  return e
348 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.movs (   ir,
  instr,
  a,
  b 
)

Definition at line 358 of file sem.py.

359 def movs(ir, instr, a, b):
360  e = []
361  e.append(ExprAff(a, b))
362  # XXX TODO check
363  e += update_flag_logic(b)
364  dst = get_dst(a)
365  if dst is not None:
366  e.append(ExprAff(ir.IRDst, b))
367  return e
368 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.movt (   ir,
  instr,
  a,
  b 
)

Definition at line 349 of file sem.py.

350 def movt(ir, instr, a, b):
351  r = a | b << ExprInt32(16)
352  e = [ExprAff(a, r)]
353  dst = get_dst(a)
354  if dst is not None:
355  e.append(ExprAff(ir.IRDst, r))
356  return e
357 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.mul (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 449 of file sem.py.

450 def mul(ir, instr, a, b, c = None):
451  e = []
452  if c is None:
453  b, c = a, b
454  r = b * c
455  e.append(ExprAff(a, r))
456  dst = get_dst(a)
457  if dst is not None:
458  e.append(ExprAff(ir.IRDst, r))
459  return e
460 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.muls (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 461 of file sem.py.

462 def muls(ir, instr, a, b, c = None):
463  e = []
464  if c is None:
465  b, c = a, b
466  r = b * c
467  e += update_flag_zn(r)
468  e.append(ExprAff(a, r))
469  dst = get_dst(a)
470  if dst is not None:
471  e.append(ExprAff(ir.IRDst, r))
472  return e
def update_flag_zn
Definition: sem.py:22

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.mvn (   ir,
  instr,
  a,
  b 
)

Definition at line 369 of file sem.py.

370 def mvn(ir, instr, a, b):
371  r = b ^ ExprInt32(-1)
372  e = [ExprAff(a, r)]
373  dst = get_dst(a)
374  if dst is not None:
375  e.append(ExprAff(ir.IRDst, r))
376  return e
377 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.mvns (   ir,
  instr,
  a,
  b 
)

Definition at line 378 of file sem.py.

379 def mvns(ir, instr, a, b):
380  e = []
381  r = b ^ ExprInt32(-1)
382  e.append(ExprAff(a, r))
383  # XXX TODO check
384  e += update_flag_logic(r)
385  dst = get_dst(a)
386  if dst is not None:
387  e.append(ExprAff(ir.IRDst, r))
388  return e
389 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.neg (   ir,
  instr,
  a,
  b 
)

Definition at line 390 of file sem.py.

391 def neg(ir, instr, a, b):
392  e = []
393  r = - b
394  e.append(ExprAff(a, r))
395  dst = get_dst(a)
396  if dst is not None:
397  e.append(ExprAff(ir.IRDst, r))
398  return e

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.negs (   ir,
  instr,
  a,
  b 
)

Definition at line 399 of file sem.py.

400 def negs(ir, instr, a, b):
401  e = subs(ir, instr, a, ExprInt_from(b, 0), b)
402  return e

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.orr (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 316 of file sem.py.

317 def orr(ir, instr, a, b, c=None):
318  e = []
319  if c is None:
320  b, c = a, b
321  r = b | c
322  e.append(ExprAff(a, r))
323  dst = get_dst(a)
324  if dst is not None:
325  e.append(ExprAff(ir.IRDst, r))
326  return e
327 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.orrs (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 328 of file sem.py.

329 def orrs(ir, instr, a, b, c=None):
330  e = []
331  if c is None:
332  b, c = a, b
333  r = b | c
334  e += update_flag_logic(r)
335  e.append(ExprAff(a, r))
336  dst = get_dst(a)
337  if dst is not None:
338  e.append(ExprAff(ir.IRDst, r))
339  return e
340 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.pop (   ir,
  instr,
  a 
)

Definition at line 821 of file sem.py.

822 def pop(ir, instr, a):
823  e = []
824  regs = list(a.args)
825  dst = None
826  for i in xrange(len(regs)):
827  r = SP + ExprInt32(4 * i)
828  e.append(ExprAff(regs[i], ExprMem(r)))
829  if regs[i] == ir.pc:
830  dst = ExprMem(r)
831  r = SP + ExprInt32(4 * len(regs))
832  e.append(ExprAff(SP, r))
833  if dst is not None:
834  e.append(ExprAff(ir.IRDst, dst))
835  return e
836 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.push (   ir,
  instr,
  a 
)

Definition at line 810 of file sem.py.

811 def push(ir, instr, a):
812  e = []
813  regs = list(a.args)
814  for i in xrange(len(regs)):
815  r = SP + ExprInt32(-4 * (i + 1))
816  e.append(ExprAff(ExprMem(r), regs[i]))
817  r = SP + ExprInt32(-4 * len(regs))
818  e.append(ExprAff(SP, r))
819  return e
820 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.rev (   ir,
  instr,
  a,
  b 
)

Definition at line 927 of file sem.py.

928 def rev(ir, instr, a, b):
929  e = []
930  c = ExprCompose([(b[:8], 24, 32),
931  (b[8:16], 16, 24),
932  (b[16:24], 8, 16),
933  (b[24:32], 0, 8)])
934  e.append(ExprAff(a, c))
935  return e
936 
937 
def miasm2.arch.arm.sem.rsb (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 199 of file sem.py.

200 def rsb(ir, instr, a, b, c=None):
201  e = []
202  if c is None:
203  b, c = a, b
204  r = c - b
205  e.append(ExprAff(a, r))
206  dst = get_dst(a)
207  if dst is not None:
208  e.append(ExprAff(ir.IRDst, r))
209  return e
210 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.rsbs (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 211 of file sem.py.

212 def rsbs(ir, instr, a, b, c=None):
213  e = []
214  if c is None:
215  b, c = a, b
216  r = c - b
217  e += update_flag_arith(r)
218  e += update_flag_sub(c, b, r)
219  e.append(ExprAff(a, r))
220  dst = get_dst(a)
221  if dst is not None:
222  e.append(ExprAff(ir.IRDst, r))
223  return e
224 
def update_flag_arith
Definition: sem.py:37
def update_flag_sub
Definition: sem.py:89

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.rsc (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 251 of file sem.py.

252 def rsc(ir, instr, a, b, c=None):
253  e = []
254  if c is None:
255  b, c = a, b
256  r = (c + cf.zeroExtend(32)) - (b + ExprInt32(1))
257  e.append(ExprAff(a, r))
258  dst = get_dst(a)
259  if dst is not None:
260  e.append(ExprAff(ir.IRDst, r))
261  return e
262 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.rscs (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 263 of file sem.py.

264 def rscs(ir, instr, a, b, c=None):
265  e = []
266  if c is None:
267  b, c = a, b
268  r = (c + cf.zeroExtend(32)) - (b + ExprInt32(1))
269  e.append(ExprAff(a, r))
270  e += update_flag_arith(r)
271  e += update_flag_sub(c, b, r)
272  e.append(ExprAff(a, r))
273  dst = get_dst(a)
274  if dst is not None:
275  e.append(ExprAff(ir.IRDst, r))
276  return e
277 
def update_flag_arith
Definition: sem.py:37
def update_flag_sub
Definition: sem.py:89

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.sbc (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 225 of file sem.py.

226 def sbc(ir, instr, a, b, c=None):
227  e = []
228  if c is None:
229  b, c = a, b
230  r = (b + cf.zeroExtend(32)) - (c + ExprInt32(1))
231  e.append(ExprAff(a, r))
232  dst = get_dst(a)
233  if dst is not None:
234  e.append(ExprAff(ir.IRDst, r))
235  return e
236 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.sbcs (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 237 of file sem.py.

238 def sbcs(ir, instr, a, b, c=None):
239  e = []
240  if c is None:
241  b, c = a, b
242  r = (b + cf.zeroExtend(32)) - (c + ExprInt32(1))
243  e += update_flag_arith(r)
244  e += update_flag_sub(b, c, r)
245  e.append(ExprAff(a, r))
246  dst = get_dst(a)
247  if dst is not None:
248  e.append(ExprAff(ir.IRDst, r))
249  return e
250 
def update_flag_arith
Definition: sem.py:37
def update_flag_sub
Definition: sem.py:89

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.smlal (   ir,
  instr,
  a,
  b,
  c,
  d 
)

Definition at line 497 of file sem.py.

498 def smlal(ir, instr, a, b, c, d):
499  e = []
500  r = c.signExtend(64) * d.signExtend(64) + ExprCompose([(a, 0, 32), (b, 32, 64)])
501  e.append(ExprAff(a, r[0:32]))
502  e.append(ExprAff(b, r[32:64]))
503  # r15/IRDst not allowed as output
504  return e
def miasm2.arch.arm.sem.smull (   ir,
  instr,
  a,
  b,
  c,
  d 
)

Definition at line 489 of file sem.py.

490 def smull(ir, instr, a, b, c, d):
491  e = []
492  r = c.signExtend(64) * d.signExtend(64)
493  e.append(ExprAff(a, r[0:32]))
494  e.append(ExprAff(b, r[32:64]))
495  # r15/IRDst not allowed as output
496  return e
def miasm2.arch.arm.sem.split_expr_dst (   ir,
  instr_ir 
)

Definition at line 1162 of file sem.py.

1163 def split_expr_dst(ir, instr_ir):
1164  out = []
1165  dst = None
1166  for i in instr_ir:
1167  if i.dst == ir.pc:
1168  out.append(i)
1169  dst = ir.pc # i.src
1170  else:
1171  out.append(i)
1172  return out, dst
1173 
def split_expr_dst
Definition: sem.py:1162
def miasm2.arch.arm.sem.st_ld_m (   ir,
  instr,
  a,
  b,
  store = False,
  postinc = False,
  updown = False 
)

Definition at line 649 of file sem.py.

650 def st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=False):
651  e = []
652  wb = False
653  # sb = False
654  dst = None
655  if isinstance(a, ExprOp) and a.op == 'wback':
656  wb = True
657  a = a.args[0]
658  if isinstance(b, ExprOp) and b.op == 'sbit':
659  # sb = True
660  b = b.args[0]
661  regs = b.args
662  base = a
663  if updown:
664  step = 4
665  else:
666  step = -4
667  regs = regs[::-1]
668  if postinc:
669  pass
670  else:
671  base += ExprInt32(step)
672  for i, r in enumerate(regs):
673  ad = base + ExprInt32(i * step)
674  if store:
675  e.append(ExprAff(ExprMem(ad), r))
676  else:
677  e.append(ExprAff(r, ExprMem(ad)))
678  if r == PC:
679  e.append(ExprAff(ir.IRDst, ExprMem(ad)))
680  # XXX TODO check multiple write cause by wb
681  if wb:
682  if postinc:
683  e.append(ExprAff(a, base + ExprInt32(len(regs) * step)))
684  else:
685  e.append(ExprAff(a, base + ExprInt32((len(regs) - 1) * step)))
686  if store:
687  pass
688  else:
689  assert(isinstance(b, ExprOp) and b.op == "reglist")
690 
691  return e
692 

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.st_ld_r (   ir,
  instr,
  a,
  b,
  store = False,
  size = 32,
  s_ext = False,
  z_ext = False 
)

Definition at line 537 of file sem.py.

538 def st_ld_r(ir, instr, a, b, store=False, size=32, s_ext=False, z_ext=False):
539  e = []
540  wb = False
541  b = b.copy()
542  postinc = False
543  b = b.arg
544  if isinstance(b, ExprOp):
545  if b.op == "wback":
546  wb = True
547  b = b.args[0]
548  if b.op == "postinc":
549  postinc = True
550  if isinstance(b, ExprOp) and b.op in ["postinc", 'preinc']:
551  # XXX TODO CHECK
552  base, off = b.args[0], b.args[1] # ExprInt32(size/8)
553  else:
554  base, off = b, ExprInt32(0)
555  # print a, wb, base, off, postinc
556  if postinc:
557  ad = base
558  else:
559  ad = base + off
560 
561  dmem = False
562  if size in [8, 16]:
563  if store:
564  a = a[:size]
565  m = ExprMem(ad, size=size)
566  elif s_ext:
567  m = ExprMem(ad, size=size).signExtend(a.size)
568  elif z_ext:
569  m = ExprMem(ad, size=size).zeroExtend(a.size)
570  else:
571  raise ValueError('unhandled case')
572  elif size == 32:
573  m = ExprMem(ad, size=size)
574  pass
575  elif size == 64:
576  m = ExprMem(ad, size=32)
577  dmem = True
578  a2 = ir.arch.regs.all_regs_ids[ir.arch.regs.all_regs_ids.index(a) + 1]
579  size = 32
580  else:
581  raise ValueError('the size DOES matter')
582  dst = None
583 
584  if store:
585  e.append(ExprAff(m, a))
586  if dmem:
587  e.append(ExprAff(ExprMem(ad + ExprInt32(4), size=size), a2))
588  else:
589  if a == PC:
590  dst = PC
591  e.append(ExprAff(ir.IRDst, m))
592  e.append(ExprAff(a, m))
593  if dmem:
594  e.append(ExprAff(a2, ExprMem(ad + ExprInt32(4), size=size)))
595 
596  # XXX TODO check multiple write cause by wb
597  if wb or postinc:
598  e.append(ExprAff(base, base + off))
599  return e
600 

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.stmda (   ir,
  instr,
  a,
  b 
)

Definition at line 717 of file sem.py.

718 def stmda(ir, instr, a, b):
719  return st_ld_m(ir, instr, a, b, store=True, postinc=True, updown=False)
720 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.stmdb (   ir,
  instr,
  a,
  b 
)

Definition at line 721 of file sem.py.

722 def stmdb(ir, instr, a, b):
723  return st_ld_m(ir, instr, a, b, store=True, postinc=False, updown=False)
724 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.stmia (   ir,
  instr,
  a,
  b 
)

Definition at line 709 of file sem.py.

710 def stmia(ir, instr, a, b):
711  return st_ld_m(ir, instr, a, b, store=True, postinc=True, updown=True)
712 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.stmib (   ir,
  instr,
  a,
  b 
)

Definition at line 713 of file sem.py.

714 def stmib(ir, instr, a, b):
715  return st_ld_m(ir, instr, a, b, store=True, postinc=False, updown=True)
716 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.strb (   ir,
  instr,
  a,
  b 
)

Definition at line 628 of file sem.py.

629 def strb(ir, instr, a, b):
630  e = st_ld_r(ir, instr, a, b, store=True, size=8)
631  return e
632 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.strh (   ir,
  instr,
  a,
  b 
)

Definition at line 638 of file sem.py.

639 def strh(ir, instr, a, b):
640  e = st_ld_r(ir, instr, a, b, store=True, size=16, z_ext=True)
641  return e
642 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.sub (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 148 of file sem.py.

149 def sub(ir, instr, a, b, c=None):
150  e = []
151  if c is None:
152  b, c = a, b
153  r = b - c
154  e.append(ExprAff(a, r))
155  dst = get_dst(a)
156  if dst is not None:
157  e.append(ExprAff(ir.IRDst, r))
158  return e
159 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.subs (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 160 of file sem.py.

161 def subs(ir, instr, a, b, c=None):
162  e = []
163  if c is None:
164  b, c = a, b
165  r = b - c
166  e += update_flag_arith(r)
167  e += update_flag_sub(b, c, r)
168  e.append(ExprAff(a, r))
169  dst = get_dst(a)
170  if dst is not None:
171  e.append(ExprAff(ir.IRDst, r))
172  return e
173 
def update_flag_arith
Definition: sem.py:37
def update_flag_sub
Definition: sem.py:89

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.svc (   ir,
  instr,
  a 
)

Definition at line 725 of file sem.py.

726 def svc(ir, instr, a):
727  # XXX TODO implement
728  e = [
729  ExprAff(exception_flags, ExprInt32(EXCEPT_PRIV_INSN))]
730  return e
731 

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.sxtb (   ir,
  instr,
  a,
  b 
)

Definition at line 872 of file sem.py.

873 def sxtb(ir, instr, a, b):
874  e = []
875  r = b[:8].signExtend(32)
876  e.append(ExprAff(a, r))
877  dst = None
878  if PC in a.get_r():
879  dst = PC
880  e.append(ExprAff(ir.IRDst, r))
881  return e
def miasm2.arch.arm.sem.sxth (   ir,
  instr,
  a,
  b 
)

Definition at line 882 of file sem.py.

883 def sxth(ir, instr, a, b):
884  e = []
885  r = b[:16].signExtend(32)
886  e.append(ExprAff(a, r))
887  dst = None
888  if PC in a.get_r():
889  dst = PC
890  e.append(ExprAff(ir.IRDst, r))
891  return e
892 
def miasm2.arch.arm.sem.teq (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 287 of file sem.py.

288 def teq(ir, instr, a, b, c=None):
289  e = []
290  if c is None:
291  b, c = a, b
292  r = b ^ c
293  e += update_flag_logic(r)
294  return e
295 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.tst (   ir,
  instr,
  a,
  b,
  c = None 
)

Definition at line 278 of file sem.py.

279 def tst(ir, instr, a, b, c=None):
280  e = []
281  if c is None:
282  b, c = a, b
283  r = b & c
284  e += update_flag_logic(r)
285  return e
286 
def update_flag_logic
Definition: sem.py:29

+ Here is the call graph for this function:

def miasm2.arch.arm.sem.ubfx (   ir,
  instr,
  a,
  b,
  c,
  d 
)

Definition at line 893 of file sem.py.

894 def ubfx(ir, instr, a, b, c, d):
895  e = []
896  c = int(c.arg)
897  d = int(d.arg)
898  r = b[c:c+d].zeroExtend(32)
899  e.append(ExprAff(a, r))
900  dst = None
901  if PC in a.get_r():
902  dst = PC
903  e.append(ExprAff(ir.IRDst, r))
904  return e
def miasm2.arch.arm.sem.umlal (   ir,
  instr,
  a,
  b,
  c,
  d 
)

Definition at line 481 of file sem.py.

482 def umlal(ir, instr, a, b, c, d):
483  e = []
484  r = c.zeroExtend(64) * d.zeroExtend(64) + ExprCompose([(a, 0, 32), (b, 32, 64)])
485  e.append(ExprAff(a, r[0:32]))
486  e.append(ExprAff(b, r[32:64]))
487  # r15/IRDst not allowed as output
488  return e
def miasm2.arch.arm.sem.umull (   ir,
  instr,
  a,
  b,
  c,
  d 
)

Definition at line 473 of file sem.py.

474 def umull(ir, instr, a, b, c, d):
475  e = []
476  r = c.zeroExtend(64) * d.zeroExtend(64)
477  e.append(ExprAff(a, r[0:32]))
478  e.append(ExprAff(b, r[32:64]))
479  # r15/IRDst not allowed as output
480  return e
def miasm2.arch.arm.sem.und (   ir,
  instr,
  a,
  b 
)

Definition at line 732 of file sem.py.

733 def und(ir, instr, a, b):
734  # XXX TODO implement
735  e = []
736  return e
737 
# TODO XXX implement correct CF for shifters
def miasm2.arch.arm.sem.update_flag_add (   x,
  y,
  z 
)

Definition at line 80 of file sem.py.

80 
81 def update_flag_add(x, y, z):
82  e = []
83  e.append(update_flag_add_cf(x, y, z))
84  e.append(update_flag_add_of(x, y, z))
85  return e
86 
87 # z = x-y (+cf?)
88 
def update_flag_add_cf
Definition: sem.py:56
def update_flag_add
Definition: sem.py:80
def update_flag_add_of
Definition: sem.py:61

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 56 of file sem.py.

56 
57 def update_flag_add_cf(op1, op2, res):
58  "Compute cf in @res = @op1 + @op2"
59  return ExprAff(cf, (((op1 ^ op2) ^ res) ^ ((op1 ^ res) & (~(op1 ^ op2)))).msb())
60 
def update_flag_add_cf
Definition: sem.py:56

+ Here is the caller graph for this function:

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

Definition at line 61 of file sem.py.

61 
62 def update_flag_add_of(op1, op2, res):
63  "Compute of in @res = @op1 + @op2"
64  return ExprAff(of, (((op1 ^ res) & (~(op1 ^ op2)))).msb())
65 
66 
# checked: ok for sbb add because b & c before +cf
def update_flag_add_of
Definition: sem.py:61

+ Here is the caller graph for this function:

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

Definition at line 37 of file sem.py.

37 
38 def update_flag_arith(a):
39  e = []
40  e += update_flag_zn(a)
41  return e
42 
def update_flag_arith
Definition: sem.py:37
def update_flag_zn
Definition: sem.py:22

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 29 of file sem.py.

29 
30 def update_flag_logic(a):
31  e = []
32  e += update_flag_zn(a)
33  # XXX TODO: set cf if ROT imm in argument
34  #e.append(ExprAff(cf, ExprInt1(0)))
35  return e
36 
def update_flag_logic
Definition: sem.py:29
def update_flag_zn
Definition: sem.py:22

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 18 of file sem.py.

18 
19 def update_flag_nf(a):
20  return [ExprAff(nf, a.msb())]
21 
def update_flag_nf
Definition: sem.py:18

+ Here is the caller graph for this function:

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

Definition at line 89 of file sem.py.

89 
90 def update_flag_sub(x, y, z):
91  e = []
92  e.append(update_flag_sub_cf(x, y, z))
93  e.append(update_flag_sub_of(x, y, z))
94  return e
95 
def update_flag_sub_cf
Definition: sem.py:67
def update_flag_sub_of
Definition: sem.py:73
def update_flag_sub
Definition: sem.py:89

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 67 of file sem.py.

67 
68 def update_flag_sub_cf(op1, op2, res):
69  "Compote CF in @res = @op1 - @op2"
70  return ExprAff(cf,
71  ((((op1 ^ op2) ^ res) ^ ((op1 ^ res) & (op1 ^ op2))).msb()) ^ ExprInt1(1))
72 
def update_flag_sub_cf
Definition: sem.py:67

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 73 of file sem.py.

73 
74 def update_flag_sub_of(op1, op2, res):
75  "Compote OF in @res = @op1 - @op2"
76  return ExprAff(of, (((op1 ^ res) & (op1 ^ op2))).msb())
77 
78 # z = x+y (+cf?)
79 
def update_flag_sub_of
Definition: sem.py:73

+ Here is the caller graph for this function:

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

Definition at line 14 of file sem.py.

14 
15 def update_flag_zf(a):
16  return [ExprAff(zf, ExprCond(a, ExprInt1(0), ExprInt1(1)))]
17 
def update_flag_zf
Definition: sem.py:14

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.update_flag_zn (   a)

Definition at line 22 of file sem.py.

22 
23 def update_flag_zn(a):
24  e = []
25  e += update_flag_zf(a)
26  e += update_flag_nf(a)
27  return e
28 
def update_flag_zf
Definition: sem.py:14
def update_flag_zn
Definition: sem.py:22
def update_flag_nf
Definition: sem.py:18

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.arm.sem.uxtb (   ir,
  instr,
  a,
  b 
)

Definition at line 852 of file sem.py.

853 def uxtb(ir, instr, a, b):
854  e = []
855  r = b[:8].zeroExtend(32)
856  e.append(ExprAff(a, r))
857  dst = None
858  if PC in a.get_r():
859  dst = PC
860  e.append(ExprAff(ir.IRDst, r))
861  return e
def miasm2.arch.arm.sem.uxth (   ir,
  instr,
  a,
  b 
)

Definition at line 862 of file sem.py.

863 def uxth(ir, instr, a, b):
864  e = []
865  r = b[:16].zeroExtend(32)
866  e.append(ExprAff(a, r))
867  dst = None
868  if PC in a.get_r():
869  dst = PC
870  e.append(ExprAff(ir.IRDst, r))
871  return e

Variable Documentation

tuple miasm2.arch.arm.sem.cn = ""

Definition at line 1149 of file sem.py.

int miasm2.arch.arm.sem.COND_AL = 14

Definition at line 952 of file sem.py.

int miasm2.arch.arm.sem.COND_CC = 3

Definition at line 941 of file sem.py.

int miasm2.arch.arm.sem.COND_CS = 2

Definition at line 940 of file sem.py.

dictionary miasm2.arch.arm.sem.cond_dct
Initial value:
1 = {
2  COND_EQ: "EQ",
3  COND_NE: "NE",
4  COND_CS: "CS",
5  COND_CC: "CC",
6  COND_MI: "MI",
7  COND_PL: "PL",
8  COND_VS: "VS",
9  COND_VC: "VC",
10  COND_HI: "HI",
11  COND_LS: "LS",
12  COND_GE: "GE",
13  COND_LT: "LT",
14  COND_GT: "GT",
15  COND_LE: "LE",
16  COND_AL: "AL",
17  # COND_NV: "NV",
18 }

Definition at line 955 of file sem.py.

int miasm2.arch.arm.sem.COND_EQ = 0

Definition at line 938 of file sem.py.

int miasm2.arch.arm.sem.COND_GE = 10

Definition at line 948 of file sem.py.

int miasm2.arch.arm.sem.COND_GT = 12

Definition at line 950 of file sem.py.

int miasm2.arch.arm.sem.COND_HI = 8

Definition at line 946 of file sem.py.

int miasm2.arch.arm.sem.COND_LE = 13

Definition at line 951 of file sem.py.

int miasm2.arch.arm.sem.COND_LS = 9

Definition at line 947 of file sem.py.

int miasm2.arch.arm.sem.COND_LT = 11

Definition at line 949 of file sem.py.

int miasm2.arch.arm.sem.COND_MI = 4

Definition at line 942 of file sem.py.

int miasm2.arch.arm.sem.COND_NE = 1

Definition at line 939 of file sem.py.

int miasm2.arch.arm.sem.COND_NV = 15

Definition at line 953 of file sem.py.

int miasm2.arch.arm.sem.COND_PL = 5

Definition at line 943 of file sem.py.

int miasm2.arch.arm.sem.COND_VC = 7

Definition at line 945 of file sem.py.

int miasm2.arch.arm.sem.COND_VS = 6

Definition at line 944 of file sem.py.

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

Definition at line 9 of file sem.py.

miasm2.arch.arm.sem.get_arm_instr_expr = get_mnemo_expr

Definition at line 1182 of file sem.py.

list miasm2.arch.arm.sem.mn_cond_x
Initial value:
1 = [mnemo_condm0,
2  mnemo_condm1,
3  mnemo_condm2]

Definition at line 1141 of file sem.py.

list miasm2.arch.arm.sem.mn_mod = mn+cn

Definition at line 1152 of file sem.py.

dictionary miasm2.arch.arm.sem.mnemo_condm0

Definition at line 1034 of file sem.py.

dictionary miasm2.arch.arm.sem.mnemo_condm1
Initial value:
1 = {'adds': add,
2  'subs': subs,
3  'eors': eors,
4  'ands': l_and,
5  'rsbs': rsbs,
6  'adcs': adc,
7  'sbcs': sbcs,
8  'rscs': rscs,
9 
10  'orrs': orrs,
11  'movs': movs,
12  'bics': bics,
13  'mvns': mvns,
14  'negs': negs,
15 
16  'muls': muls,
17  'mlas': mlas,
18  'blx': blx,
19 
20  'ldrb': ldrb,
21  'ldrsb': ldrsb,
22  'ldsb': ldrsb,
23  'strb': strb,
24  }

Definition at line 1082 of file sem.py.

dictionary miasm2.arch.arm.sem.mnemo_condm2
Initial value:
1 = {'ldmia': ldmia,
2  'ldmib': ldmib,
3  'ldmda': ldmda,
4  'ldmdb': ldmdb,
5 
6  'ldmfa': ldmda,
7  'ldmfd': ldmia,
8  'ldmea': ldmdb,
9  'ldmed': ldmib, # XXX
10 
11 
12  'stmia': stmia,
13  'stmib': stmib,
14  'stmda': stmda,
15  'stmdb': stmdb,
16 
17  'stmfa': stmib,
18  'stmed': stmda,
19  'stmfd': stmdb,
20  'stmea': stmia,
21  }

Definition at line 1107 of file sem.py.

dictionary miasm2.arch.arm.sem.mnemo_func = {}

Definition at line 1032 of file sem.py.

dictionary miasm2.arch.arm.sem.mnemo_func_cond = {}

Definition at line 1033 of file sem.py.

dictionary miasm2.arch.arm.sem.mnemo_nocond
Initial value:
1 = {'lsr': lsr,
2  'lsrs': lsrs,
3  'lsl': lsl,
4  'lsls': lsls,
5  'push': push,
6  'pop': pop,
7  'asr': asr,
8  'asrs': asrs,
9  'cbz': cbz,
10  'cbnz': cbnz,
11  }

Definition at line 1130 of file sem.py.

dictionary miasm2.arch.arm.sem.tab_cond
Initial value:
1 = {COND_EQ: zf,
2  COND_NE: ExprCond(zf, ExprInt1(0), ExprInt1(1)),
3  COND_CS: cf,
4  COND_CC: ExprCond(cf, ExprInt1(0), ExprInt1(1)),
5  COND_MI: nf,
6  COND_PL: ExprCond(nf, ExprInt1(0), ExprInt1(1)),
7  COND_VS: of,
8  COND_VC: ExprCond(of, ExprInt1(0), ExprInt1(1)),
9  COND_HI: cf & ExprCond(zf, ExprInt1(0), ExprInt1(1)),
10  # COND_HI: cf,
11  # COND_HI: ExprOp('==',
12  # ExprOp('|', cf, zf),
13  # ExprInt1(0)),
14  COND_LS: ExprCond(cf, ExprInt1(0), ExprInt1(1)) | zf,
15  COND_GE: ExprCond(nf - of, ExprInt1(0), ExprInt1(1)),
16  COND_LT: nf ^ of,
17  # COND_GT: ExprOp('|',
18  # ExprOp('==', zf, ExprInt1(0)) & (nf | of),
19  # ExprOp('==', nf, ExprInt1(0)) & ExprOp('==', of, ExprInt1(0))),
20  COND_GT: (ExprCond(zf, ExprInt1(0), ExprInt1(1)) &
21  ExprCond(nf - of, ExprInt1(0), ExprInt1(1))),
22  COND_LE: zf | (nf ^ of),
23  }

Definition at line 975 of file sem.py.