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

Classes

class  additional_info
 
class  bs_cond_off_d
 
class  bs_cond_off_s
 
class  bw_mn
 
class  instruction_msp430
 
class  mn_msp430
 
class  msp430_dreg_arg
 
class  msp430_offs
 
class  msp430_sreg_arg
 

Functions

def deref2expr_nooff
 
def deref2expr_pinc
 
def deref2expr_off
 
def deref_expr
 
def f_reg2expr
 
def ast_id2expr
 
def ast_int2expr
 
def addop
 

Variables

tuple log = logging.getLogger("msp430dis")
 
tuple console_handler = logging.StreamHandler()
 
list conditional_branch
 
list unconditional_branch = ['jmp']
 
tuple ARO = Suppress("@")
 
tuple LPARENT = Suppress("(")
 
tuple RPARENT = Suppress(")")
 
tuple PINC = Suppress("+")
 
tuple my_var_parser = parse_ast(ast_id2expr, ast_int2expr)
 
tuple deref_nooff = Group(ARO + base_expr)
 
tuple deref_pinc = Group(ARO + base_expr + PINC)
 
tuple deref_off
 
tuple sreg_p
 
 mode_msp430 = None
 
tuple off_s = bs(l=16, order=-10, cls=(bs_cond_off_s,), fname = "off_s")
 
tuple off_d = bs(l=16, order=-10, cls=(bs_cond_off_d,), fname = "off_d")
 
tuple a_s = bs(l=2, order=-4, fname='a_s')
 
tuple a_d = bs(l=1, order=-6, fname='a_d')
 
tuple a_d2 = bs(l=2, order=-2, fname='a_d')
 
tuple sreg = bs(l=4, order=-3, cls=(msp430_sreg_arg,), fname='sreg')
 
tuple dreg = bs(l=4, order=-5, cls=(msp430_dreg_arg,), fname='dreg')
 
tuple bw = bw_mn(l=1, order=-10, mn_mod=['.w', '.b'], fname='size')
 
tuple bs_f1
 
tuple bs_f2
 
tuple bs_f2_nobw
 
tuple offimm = bs(l=10, cls=(msp430_offs,), fname="offs", order=-1)
 
tuple bs_f2_jcc
 

Function Documentation

def miasm2.arch.msp430.arch.addop (   name,
  fields,
  args = None,
  alias = False 
)

Definition at line 305 of file arch.py.

306 def addop(name, fields, args=None, alias=False):
307  dct = {"fields": fields}
308  dct["alias"] = alias
309  if args is not None:
310  dct['args'] = args
311  type(name, (mn_msp430,), dct)
312 
def miasm2.arch.msp430.arch.ast_id2expr (   t)

Definition at line 75 of file arch.py.

75 
76 def ast_id2expr(t):
77  if not t in mn_msp430.regs.all_regs_ids_byname:
78  r = ExprId(asm_label(t), 16)
79  else:
80  r = mn_msp430.regs.all_regs_ids_byname[t]
81  return r
82 
def miasm2.arch.msp430.arch.ast_int2expr (   a)

Definition at line 83 of file arch.py.

83 
84 def ast_int2expr(a):
85  return ExprInt16(a)
86 
87 
88 variable, operand, base_expr = gen_base_expr()
def gen_base_expr
Definition: cpu.py:309

+ Here is the call graph for this function:

def miasm2.arch.msp430.arch.deref2expr_nooff (   s,
  l,
  t 
)

Definition at line 24 of file arch.py.

24 
25 def deref2expr_nooff(s, l, t):
26  t = t[0]
27  if len(t) == 1 and isinstance(t[0], ExprId):
28  return ExprMem(t[0], 16)
29  elif len(t) == 1 and isinstance(t[0], ExprInt):
30  return ExprMem(t[0], 16)
31  raise NotImplementedError('not fully functional')
32 
def miasm2.arch.msp430.arch.deref2expr_off (   s,
  l,
  t 
)

Definition at line 40 of file arch.py.

40 
41 def deref2expr_off(s, l, t):
42  t = t[0]
43  if len(t) == 2 and isinstance(t[1], ExprId):
44  return ExprMem(t[1] + t[0], 16)
45  raise NotImplementedError('not fully functional')
46 
def miasm2.arch.msp430.arch.deref2expr_pinc (   s,
  l,
  t 
)

Definition at line 33 of file arch.py.

33 
34 def deref2expr_pinc(s, l, t):
35  t = t[0]
36  if len(t) == 1 and isinstance(t[0], ExprId):
37  return ExprOp('autoinc', t[0])
38  raise NotImplementedError('not fully functional')
39 
def miasm2.arch.msp430.arch.deref_expr (   s,
  l,
  t 
)

Definition at line 47 of file arch.py.

47 
48 def deref_expr(s, l, t):
49  t = t[0]
50  assert(len(t) == 1)
51  t = t[0]
52  if isinstance(t, ExprId) or \
53  isinstance(t, ExprInt) or \
54  isinstance(t, ExprMem) or \
55  (isinstance(t, ExprOp) and t.op == "autoinc"):
56  return t
57 
58  raise NotImplementedError('not fully functional')
59 
def miasm2.arch.msp430.arch.f_reg2expr (   t)

Definition at line 60 of file arch.py.

60 
61 def f_reg2expr(t):
62  t = t[0]
63  i = regs16_str.index(t)
64  r = regs16_expr[i]
65  return r
66 
67 # gpregs.parser.setParseAction(f_reg2expr)

Variable Documentation

tuple miasm2.arch.msp430.arch.a_d = bs(l=1, order=-6, fname='a_d')

Definition at line 564 of file arch.py.

tuple miasm2.arch.msp430.arch.a_d2 = bs(l=2, order=-2, fname='a_d')

Definition at line 566 of file arch.py.

tuple miasm2.arch.msp430.arch.a_s = bs(l=2, order=-4, fname='a_s')

Definition at line 563 of file arch.py.

tuple miasm2.arch.msp430.arch.ARO = Suppress("@")

Definition at line 68 of file arch.py.

tuple miasm2.arch.msp430.arch.bs_f1
Initial value:
2  l=4, name={
3  'mov': 4, 'add': 5, 'addc': 6, 'subc': 7, 'sub': 8, 'cmp': 9,
4  'dadd': 10, 'bit': 11, 'bic': 12, 'bis': 13, 'xor': 14, 'and': 15})

Definition at line 573 of file arch.py.

tuple miasm2.arch.msp430.arch.bs_f2
Initial value:
1 = bs_name(l=3, name={'rrc': 0, 'rra': 2,
2  'push': 4})

Definition at line 579 of file arch.py.

tuple miasm2.arch.msp430.arch.bs_f2_jcc
Initial value:
1 = bs_name(l=3, name={'jnz': 0, 'jz': 1, 'jnc': 2, 'jc': 3, 'jn': 4,
2  'jge': 5, 'jl': 6, 'jmp': 7})

Definition at line 591 of file arch.py.

tuple miasm2.arch.msp430.arch.bs_f2_nobw
Initial value:
1 = bs_name(l=3, name={'swpb': 1, 'sxt': 3,
2  'call': 5})

Definition at line 584 of file arch.py.

tuple miasm2.arch.msp430.arch.bw = bw_mn(l=1, order=-10, mn_mod=['.w', '.b'], fname='size')

Definition at line 571 of file arch.py.

list miasm2.arch.msp430.arch.conditional_branch
Initial value:
1 = ['jnz', 'jz', 'jnc', 'jc',
2  'jn', 'jge', 'jl']

Definition at line 20 of file arch.py.

tuple miasm2.arch.msp430.arch.console_handler = logging.StreamHandler()

Definition at line 15 of file arch.py.

tuple miasm2.arch.msp430.arch.deref_nooff = Group(ARO + base_expr)

Definition at line 93 of file arch.py.

tuple miasm2.arch.msp430.arch.deref_off
Initial value:
1 = Group(base_expr + LPARENT +
2  gpregs.parser + RPARENT)

Definition at line 95 of file arch.py.

tuple miasm2.arch.msp430.arch.deref_pinc = Group(ARO + base_expr + PINC)

Definition at line 94 of file arch.py.

tuple miasm2.arch.msp430.arch.dreg = bs(l=4, order=-5, cls=(msp430_dreg_arg,), fname='dreg')

Definition at line 569 of file arch.py.

tuple miasm2.arch.msp430.arch.log = logging.getLogger("msp430dis")

Definition at line 14 of file arch.py.

tuple miasm2.arch.msp430.arch.LPARENT = Suppress("(")

Definition at line 69 of file arch.py.

miasm2.arch.msp430.arch.mode_msp430 = None

Definition at line 211 of file arch.py.

tuple miasm2.arch.msp430.arch.my_var_parser = parse_ast(ast_id2expr, ast_int2expr)

Definition at line 89 of file arch.py.

tuple miasm2.arch.msp430.arch.off_d = bs(l=16, order=-10, cls=(bs_cond_off_d,), fname = "off_d")

Definition at line 561 of file arch.py.

tuple miasm2.arch.msp430.arch.off_s = bs(l=16, order=-10, cls=(bs_cond_off_s,), fname = "off_s")

Definition at line 560 of file arch.py.

tuple miasm2.arch.msp430.arch.offimm = bs(l=10, cls=(msp430_offs,), fname="offs", order=-1)

Definition at line 589 of file arch.py.

tuple miasm2.arch.msp430.arch.PINC = Suppress("+")

Definition at line 72 of file arch.py.

tuple miasm2.arch.msp430.arch.RPARENT = Suppress(")")

Definition at line 70 of file arch.py.

tuple miasm2.arch.msp430.arch.sreg = bs(l=4, order=-3, cls=(msp430_sreg_arg,), fname='sreg')

Definition at line 568 of file arch.py.

tuple miasm2.arch.msp430.arch.sreg_p
Initial value:
1 = Group(deref_pinc | deref_nooff |
2  deref_off | base_expr)

Definition at line 99 of file arch.py.

list miasm2.arch.msp430.arch.unconditional_branch = ['jmp']

Definition at line 22 of file arch.py.