miasm
Reverse engineering framework
miasm.arch.mep.arch Namespace Reference

Classes

class  instruction_mep
 
class  mep_abs24
 
class  mep_additional_info
 
class  mep_arg
 
class  mep_code20
 
class  mep_code24
 
class  mep_copro_reg
 
class  mep_copro_reg_split
 
class  mep_deref_inc_reg
 
class  mep_deref_reg
 
class  mep_deref_reg_offset
 
class  mep_deref_sp_offset
 
class  mep_deref_tp_offset
 
class  mep_disp12_align2
 
class  mep_disp12_align2_signed
 
class  mep_disp17
 
class  mep_disp7_align2
 
class  mep_disp8_align2
 
class  mep_disp8_align4
 
class  mep_imm
 
class  mep_imm16
 
class  mep_imm16_signed
 
class  mep_imm24
 
class  mep_imm5_Iiiii
 
class  mep_imm6
 
class  mep_imm7_align4
 
class  mep_imm8
 
class  mep_imm8_align8
 
class  mep_int32_noarg
 
class  mep_reg
 
class  mep_reg_sp
 
class  mep_reg_tp
 
class  mep_target24
 
class  mep_target24_signed
 
class  mn_mep
 

Functions

def ExprInt2SignedString (expr, pos_fmt="%d", neg_fmt="%d", size=None, offset=0)
 
def addop (name, fields, args=None, alias=False)
 
def deref2expr (s, l, parse_results)
 

Variables

 LPARENTHESIS = Literal("(")
 
 RPARENTHESIS = Literal(")")
 
 PLUSSIGN = Literal("+")
 
 HEX_INTEGER = str_int_pos | str_int_neg
 
 deref_reg_parser = Group(LPARENTHESIS + gpr_infos.parser + RPARENTHESIS).setParseAction(deref2expr)
 
 deref_inc_reg_parser = Group(LPARENTHESIS + gpr_infos.parser + PLUSSIGN + RPARENTHESIS).setParseAction(deref2expr)
 
 abs24_deref_parser = Group(LPARENTHESIS + HEX_INTEGER + RPARENTHESIS).setParseAction(deref2expr)
 
 offset_deref_reg_parser = Group(HEX_INTEGER + LPARENTHESIS + gpr_infos.parser + RPARENTHESIS).setParseAction(deref2expr)
 
 reg04
 
 reg04_l = bs(l=4, cls=(mep_reg, ))
 
 reg04_m = bs(l=4, cls=(mep_reg, ))
 
 reg04_n = bs(l=4, cls=(mep_reg, ))
 
 reg00 = bs(l=0, cls=(mep_reg, ))
 
 reg00_sp = bs(l=0, cls=(mep_reg_sp, ))
 
 reg00_tp = bs(l=0, cls=(mep_reg_tp, ))
 
 reg00_deref_sp = bs(l=0, cls=(mep_deref_sp_offset, ))
 
 reg00_deref_tp = bs(l=0, cls=(mep_deref_tp_offset, ))
 
 reg03 = bs(l=3, cls=(mep_reg, ))
 
 reg04_deref = bs(l=4, cls=(mep_deref_reg,))
 
 reg04_deref_noarg = bs(l=4, fname="reg04_deref")
 
 reg04_inc_deref = bs(l=4, cls=(mep_deref_inc_reg,))
 
 copro_reg04 = bs(l=4, cls=(mep_copro_reg,))
 
 copro_reg05 = bs(l=1, cls=(mep_copro_reg_split,))
 
 copro_reg06 = bs(l=2, cls=(mep_copro_reg_split,))
 
 disp2 = bs(l=2, cls=(mep_imm, ))
 
 imm2 = disp2
 
 imm3 = bs(l=3, cls=(mep_imm, ))
 
 imm4 = bs(l=4, cls=(mep_imm, ))
 
 imm4_noarg = bs(l=4, fname="imm4")
 
 imm4_iiii_noarg = bs(l=4, fname="imm4_iiii")
 
 imm5 = bs(l=5, cls=(mep_imm, ))
 
 imm5_Iiiii = bs(l=1, cls=(mep_imm5_Iiiii, ))
 
 imm6 = bs(l=6, cls=(mep_imm6, mep_arg))
 
 imm6_noarg = bs(l=6, fname="imm6")
 
 imm7 = bs(l=7, cls=(mep_imm, ))
 
 imm7_noarg = bs(l=7, fname="imm7")
 
 imm7_align4 = bs(l=5, cls=(mep_imm7_align4,))
 
 imm7_align4_noarg = bs(l=5, fname="imm7_align4")
 
 disp7_align2 = bs(l=6, cls=(mep_disp7_align2,))
 
 disp7_align2_noarg = bs(l=6, fname="disp7_align2")
 
 imm8 = bs(l=8, cls=(mep_imm8, mep_arg))
 
 imm8_noarg = bs(l=8, fname="imm8_CCCC_CCCC")
 
 disp8 = bs(l=7, cls=(mep_disp8_align2, ))
 
 imm8_align2 = bs(l=7, cls=(mep_disp8_align2, ))
 
 imm8_align4 = bs(l=6, cls=(mep_disp8_align4, ))
 
 imm8_align8 = bs(l=5, cls=(mep_imm8_align8, ))
 
 imm12 = bs(l=12, cls=(mep_imm, ))
 
 disp12_signed = bs(l=11, cls=(mep_disp12_align2_signed, ))
 
 imm16 = bs(l=16, cls=(mep_imm16, mep_arg))
 
 imm16_signed = bs(l=16, cls=(mep_imm16_signed, mep_arg))
 
 disp16_reg_deref = bs(l=16, cls=(mep_deref_reg_offset,))
 
 disp17 = bs(l=16, cls=(mep_disp17, ))
 
 imm18 = bs(l=19, cls=(mep_imm, ))
 
 imm_code20 = bs(l=16, cls=(mep_code20, ))
 
 imm24 = bs(l=24, cls=(mep_imm24, ))
 
 imm_target24 = bs(l=16, cls=(mep_target24, ))
 
 imm_target24_signed = bs(l=16, cls=(mep_target24_signed, ))
 
 imm_code24 = bs(l=16, cls=(mep_code24, ))
 
 abs24 = bs(l=16, cls=(mep_abs24, ))
 

Function Documentation

◆ addop()

def miasm.arch.mep.arch.addop (   name,
  fields,
  args = None,
  alias = False 
)
Dynamically create the "name" object

Notes:
    - it could be moved to a generic function such as:
      addop(name, fields, cls_mn, args=None, alias=False).
    - most architectures use the same code

Args:
    name:   the mnemonic name
    fields: used to fill the object.__dict__'fields' attribute # GV: not understood yet
    args:   used to fill the object.__dict__'fields' attribute # GV: not understood yet
    alias:  used to fill the object.__dict__'fields' attribute # GV: not understood yet

◆ deref2expr()

def miasm.arch.mep.arch.deref2expr (   s,
  l,
  parse_results 
)
Convert a parsed dereferenced register to an ExprMem

◆ ExprInt2SignedString()

def miasm.arch.mep.arch.ExprInt2SignedString (   expr,
  pos_fmt = "%d",
  neg_fmt = "%d",
  size = None,
  offset = 0 
)
Return the signed string corresponding to an ExprInt

   Note: this function is only useful to mimic objdump output

Variable Documentation

◆ abs24

miasm.arch.mep.arch.abs24 = bs(l=16, cls=(mep_abs24, ))

◆ abs24_deref_parser

miasm.arch.mep.arch.abs24_deref_parser = Group(LPARENTHESIS + HEX_INTEGER + RPARENTHESIS).setParseAction(deref2expr)

◆ copro_reg04

miasm.arch.mep.arch.copro_reg04 = bs(l=4, cls=(mep_copro_reg,))

◆ copro_reg05

miasm.arch.mep.arch.copro_reg05 = bs(l=1, cls=(mep_copro_reg_split,))

◆ copro_reg06

miasm.arch.mep.arch.copro_reg06 = bs(l=2, cls=(mep_copro_reg_split,))

◆ deref_inc_reg_parser

miasm.arch.mep.arch.deref_inc_reg_parser = Group(LPARENTHESIS + gpr_infos.parser + PLUSSIGN + RPARENTHESIS).setParseAction(deref2expr)

◆ deref_reg_parser

miasm.arch.mep.arch.deref_reg_parser = Group(LPARENTHESIS + gpr_infos.parser + RPARENTHESIS).setParseAction(deref2expr)

◆ disp12_signed

miasm.arch.mep.arch.disp12_signed = bs(l=11, cls=(mep_disp12_align2_signed, ))

◆ disp16_reg_deref

miasm.arch.mep.arch.disp16_reg_deref = bs(l=16, cls=(mep_deref_reg_offset,))

◆ disp17

miasm.arch.mep.arch.disp17 = bs(l=16, cls=(mep_disp17, ))

◆ disp2

miasm.arch.mep.arch.disp2 = bs(l=2, cls=(mep_imm, ))

◆ disp7_align2

miasm.arch.mep.arch.disp7_align2 = bs(l=6, cls=(mep_disp7_align2,))

◆ disp7_align2_noarg

miasm.arch.mep.arch.disp7_align2_noarg = bs(l=6, fname="disp7_align2")

◆ disp8

miasm.arch.mep.arch.disp8 = bs(l=7, cls=(mep_disp8_align2, ))

◆ HEX_INTEGER

miasm.arch.mep.arch.HEX_INTEGER = str_int_pos | str_int_neg

◆ imm12

miasm.arch.mep.arch.imm12 = bs(l=12, cls=(mep_imm, ))

◆ imm16

miasm.arch.mep.arch.imm16 = bs(l=16, cls=(mep_imm16, mep_arg))

◆ imm16_signed

miasm.arch.mep.arch.imm16_signed = bs(l=16, cls=(mep_imm16_signed, mep_arg))

◆ imm18

miasm.arch.mep.arch.imm18 = bs(l=19, cls=(mep_imm, ))

◆ imm2

miasm.arch.mep.arch.imm2 = disp2

◆ imm24

miasm.arch.mep.arch.imm24 = bs(l=24, cls=(mep_imm24, ))

◆ imm3

miasm.arch.mep.arch.imm3 = bs(l=3, cls=(mep_imm, ))

◆ imm4

miasm.arch.mep.arch.imm4 = bs(l=4, cls=(mep_imm, ))

◆ imm4_iiii_noarg

miasm.arch.mep.arch.imm4_iiii_noarg = bs(l=4, fname="imm4_iiii")

◆ imm4_noarg

miasm.arch.mep.arch.imm4_noarg = bs(l=4, fname="imm4")

◆ imm5

miasm.arch.mep.arch.imm5 = bs(l=5, cls=(mep_imm, ))

◆ imm5_Iiiii

miasm.arch.mep.arch.imm5_Iiiii = bs(l=1, cls=(mep_imm5_Iiiii, ))

◆ imm6

miasm.arch.mep.arch.imm6 = bs(l=6, cls=(mep_imm6, mep_arg))

◆ imm6_noarg

miasm.arch.mep.arch.imm6_noarg = bs(l=6, fname="imm6")

◆ imm7

miasm.arch.mep.arch.imm7 = bs(l=7, cls=(mep_imm, ))

◆ imm7_align4

miasm.arch.mep.arch.imm7_align4 = bs(l=5, cls=(mep_imm7_align4,))

◆ imm7_align4_noarg

miasm.arch.mep.arch.imm7_align4_noarg = bs(l=5, fname="imm7_align4")

◆ imm7_noarg

miasm.arch.mep.arch.imm7_noarg = bs(l=7, fname="imm7")

◆ imm8

miasm.arch.mep.arch.imm8 = bs(l=8, cls=(mep_imm8, mep_arg))

◆ imm8_align2

miasm.arch.mep.arch.imm8_align2 = bs(l=7, cls=(mep_disp8_align2, ))

◆ imm8_align4

miasm.arch.mep.arch.imm8_align4 = bs(l=6, cls=(mep_disp8_align4, ))

◆ imm8_align8

miasm.arch.mep.arch.imm8_align8 = bs(l=5, cls=(mep_imm8_align8, ))

◆ imm8_noarg

miasm.arch.mep.arch.imm8_noarg = bs(l=8, fname="imm8_CCCC_CCCC")

◆ imm_code20

miasm.arch.mep.arch.imm_code20 = bs(l=16, cls=(mep_code20, ))

◆ imm_code24

miasm.arch.mep.arch.imm_code24 = bs(l=16, cls=(mep_code24, ))

◆ imm_target24

miasm.arch.mep.arch.imm_target24 = bs(l=16, cls=(mep_target24, ))

◆ imm_target24_signed

miasm.arch.mep.arch.imm_target24_signed = bs(l=16, cls=(mep_target24_signed, ))

◆ LPARENTHESIS

miasm.arch.mep.arch.LPARENTHESIS = Literal("(")

◆ offset_deref_reg_parser

miasm.arch.mep.arch.offset_deref_reg_parser = Group(HEX_INTEGER + LPARENTHESIS + gpr_infos.parser + RPARENTHESIS).setParseAction(deref2expr)

◆ PLUSSIGN

miasm.arch.mep.arch.PLUSSIGN = Literal("+")

◆ reg00

miasm.arch.mep.arch.reg00 = bs(l=0, cls=(mep_reg, ))

◆ reg00_deref_sp

miasm.arch.mep.arch.reg00_deref_sp = bs(l=0, cls=(mep_deref_sp_offset, ))

◆ reg00_deref_tp

miasm.arch.mep.arch.reg00_deref_tp = bs(l=0, cls=(mep_deref_tp_offset, ))

◆ reg00_sp

miasm.arch.mep.arch.reg00_sp = bs(l=0, cls=(mep_reg_sp, ))

◆ reg00_tp

miasm.arch.mep.arch.reg00_tp = bs(l=0, cls=(mep_reg_tp, ))

◆ reg03

miasm.arch.mep.arch.reg03 = bs(l=3, cls=(mep_reg, ))

◆ reg04

miasm.arch.mep.arch.reg04
Initial value:
1 = bs(l=4, # length in bits
2  cls=(mep_reg, ))

◆ reg04_deref

miasm.arch.mep.arch.reg04_deref = bs(l=4, cls=(mep_deref_reg,))

◆ reg04_deref_noarg

miasm.arch.mep.arch.reg04_deref_noarg = bs(l=4, fname="reg04_deref")

◆ reg04_inc_deref

miasm.arch.mep.arch.reg04_inc_deref = bs(l=4, cls=(mep_deref_inc_reg,))

◆ reg04_l

miasm.arch.mep.arch.reg04_l = bs(l=4, cls=(mep_reg, ))

◆ reg04_m

miasm.arch.mep.arch.reg04_m = bs(l=4, cls=(mep_reg, ))

◆ reg04_n

miasm.arch.mep.arch.reg04_n = bs(l=4, cls=(mep_reg, ))

◆ RPARENTHESIS

miasm.arch.mep.arch.RPARENTHESIS = Literal(")")
arch.bs
bs
Definition: arch.py:748