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

Classes

class  additional_info
 
class  bs_cond
 
class  bs_cond_mod
 
class  bs_cond_name
 
class  instruction_mips32
 
class  mips32_arg
 
class  mips32_cpr
 
class  mips32_dreg_imm
 
class  mips32_eposh
 
class  mips32_esize
 
class  mips32_fccreg
 
class  mips32_fltpreg
 
class  mips32_gpreg
 
class  mips32_imm
 
class  mips32_instr_index
 
class  mips32_reg
 
class  mips32_s09imm
 
class  mips32_s09imm_noarg
 
class  mips32_s16imm
 
class  mips32_s16imm_noarg
 
class  mips32_soff
 
class  mips32_soff_noarg
 
class  mips32_u16imm
 
class  mn_mips32
 

Functions

def cb_deref (tokens)
 
def cb_deref_nooff (tokens)
 
def mips32op (name, fields, args=None, alias=False)
 

Variables

 log = logging.getLogger("mips32dis")
 
 console_handler = logging.StreamHandler()
 
 gpregs = cpu.reg_info(regs.regs32_str, regs.regs32_expr)
 
 LPARENTHESIS = Literal("(")
 
 RPARENTHESIS = Literal(")")
 
 base_expr = cpu.base_expr
 
tuple deref_off = (Optional(base_expr) + LPARENTHESIS + gpregs.parser + RPARENTHESIS).setParseAction(cb_deref)
 
tuple deref_nooff = (LPARENTHESIS + gpregs.parser + RPARENTHESIS).setParseAction(cb_deref_nooff)
 
tuple deref = deref_off | deref_nooff
 
list br_0 = ['B', 'J', 'JR', 'BAL', 'JAL', 'JALR']
 
list br_1 = ['BGEZ', 'BLTZ', 'BGTZ', 'BGTZL', 'BLEZ', 'BLEZL', 'BC1T', 'BC1TL', 'BC1F', 'BC1FL']
 
list br_2 = ['BEQ', 'BEQL', 'BNE', 'BNEL']
 
 rs = cpu.bs(l=5, cls=(mips32_gpreg,))
 
 rt = cpu.bs(l=5, cls=(mips32_gpreg,))
 
 rd = cpu.bs(l=5, cls=(mips32_gpreg,))
 
 ft = cpu.bs(l=5, cls=(mips32_fltpreg,))
 
 fs = cpu.bs(l=5, cls=(mips32_fltpreg,))
 
 fd = cpu.bs(l=5, cls=(mips32_fltpreg,))
 
 s16imm = cpu.bs(l=16, cls=(mips32_s16imm,))
 
 u16imm = cpu.bs(l=16, cls=(mips32_u16imm,))
 
 s09imm = cpu.bs(l=9, cls=(mips32_s09imm,))
 
 sa = cpu.bs(l=5, cls=(mips32_u16imm,))
 
 base = cpu.bs(l=5, cls=(mips32_dreg_imm,))
 
 soff = cpu.bs(l=16, cls=(mips32_soff,))
 
 oper = cpu.bs(l=5, cls=(mips32_u16imm,))
 
 cpr0 = cpu.bs(l=5, cls=(mips32_imm,), fname="cpr0")
 
 cpr = cpu.bs(l=3, cls=(mips32_cpr,))
 
 stype = cpu.bs(l=5, cls=(mips32_u16imm,))
 
 hint_pref = cpu.bs(l=5, cls=(mips32_u16imm,))
 
 s16imm_noarg
 
 s09imm_noarg
 
 hint = cpu.bs(l=5, default_val="00000")
 
 fcc = cpu.bs(l=3, cls=(mips32_fccreg,))
 
 sel = cpu.bs(l=3, cls=(mips32_u16imm,))
 
 code = cpu.bs(l=20, cls=(mips32_u16imm,))
 
 esize = cpu.bs(l=5, cls=(mips32_esize,))
 
 epos
 
 eposh = cpu.bs(l=5, cls=(mips32_eposh,))
 
 instr_index = cpu.bs(l=26, cls=(mips32_instr_index,))
 
 bs_fmt
 
 bs_cond
 
 bs_arith
 
 bs_shift
 
 bs_shift1
 
 bs_arithfmt
 
 bs_s_l
 
 bs_oax
 
 bs_bcc
 
 bs_code = cpu.bs(l=10)
 
 alias
 

Function Documentation

◆ cb_deref()

def miasm.arch.mips32.arch.cb_deref (   tokens)

◆ cb_deref_nooff()

def miasm.arch.mips32.arch.cb_deref_nooff (   tokens)

◆ mips32op()

def miasm.arch.mips32.arch.mips32op (   name,
  fields,
  args = None,
  alias = False 
)

Variable Documentation

◆ alias

miasm.arch.mips32.arch.alias

◆ base

miasm.arch.mips32.arch.base = cpu.bs(l=5, cls=(mips32_dreg_imm,))

◆ base_expr

miasm.arch.mips32.arch.base_expr = cpu.base_expr

◆ br_0

list miasm.arch.mips32.arch.br_0 = ['B', 'J', 'JR', 'BAL', 'JAL', 'JALR']

◆ br_1

list miasm.arch.mips32.arch.br_1 = ['BGEZ', 'BLTZ', 'BGTZ', 'BGTZL', 'BLEZ', 'BLEZL', 'BC1T', 'BC1TL', 'BC1F', 'BC1FL']

◆ br_2

list miasm.arch.mips32.arch.br_2 = ['BEQ', 'BEQL', 'BNE', 'BNEL']

◆ bs_arith

miasm.arch.mips32.arch.bs_arith
Initial value:
1 = cpu.bs_name(l=6, name={'ADDU':0b100001,
2  'SUBU':0b100011,
3  'OR':0b100101,
4  'AND':0b100100,
5  'SLTU':0b101011,
6  'XOR':0b100110,
7  'SLT':0b101010,
8  'SUBU':0b100011,
9  'NOR':0b100111,
10  'MOVN':0b001011,
11  'MOVZ':0b001010,
12  })

◆ bs_arithfmt

miasm.arch.mips32.arch.bs_arithfmt
Initial value:
1 = cpu.bs_name(l=6, name={'ADD':0b000000,
2  'SUB':0b000001,
3  'MUL':0b000010,
4  'DIV':0b000011,
5  })

◆ bs_bcc

miasm.arch.mips32.arch.bs_bcc
Initial value:
1 = cpu.bs_name(l=5, name = {"BGEZ": 0b00001,
2  "BGEZL": 0b00011,
3  "BGEZAL": 0b10001,
4  "BGEZALL": 0b10011,
5  "BLTZ": 0b00000,
6  "BLTZL": 0b00010,
7  "BLTZAL": 0b10000,
8  "BLTZALL": 0b10010,
9  })

◆ bs_code

miasm.arch.mips32.arch.bs_code = cpu.bs(l=10)

◆ bs_cond

Initial value:
1 = bs_cond_mod(l=4,
2  mn_mod = ['.F', '.UN', '.EQ', '.UEQ',
3  '.OLT', '.ULT', '.OLE', '.ULE',
4  '.SF', '.NGLE', '.SEQ', '.NGL',
5  '.LT', '.NGE', '.LE', '.NGT'])

◆ bs_fmt

miasm.arch.mips32.arch.bs_fmt
Initial value:
1 = cpu.bs_mod_name(l=5, fname='fmt', mn_mod={0x10: '.S', 0x11: '.D',
2  0x14: '.W', 0x15: '.L',
3  0x16: '.PS'})

◆ bs_oax

miasm.arch.mips32.arch.bs_oax
Initial value:
1 = cpu.bs_name(l=6, name = {"ORI": 0b001101,
2  "ANDI": 0b001100,
3  "XORI": 0b001110,
4  })

◆ bs_s_l

miasm.arch.mips32.arch.bs_s_l
Initial value:
1 = cpu.bs_name(l=6, name = {"SW": 0b101011,
2  "SH": 0b101001,
3  "SB": 0b101000,
4  "LW": 0b100011,
5  "LH": 0b100001,
6  "LB": 0b100000,
7  "LHU": 0b100101,
8  "LBU": 0b100100,
9  "LWL": 0b100010,
10  "LWR": 0b100110,
11 
12  "SWL": 0b101010,
13  "SWR": 0b101110,
14  })

◆ bs_shift

miasm.arch.mips32.arch.bs_shift
Initial value:
1 = cpu.bs_name(l=6, name={'SLL':0b000000,
2  'SRL':0b000010,
3  'SRA':0b000011,
4  })

◆ bs_shift1

miasm.arch.mips32.arch.bs_shift1
Initial value:
1 = cpu.bs_name(l=6, name={'SLLV':0b000100,
2  'SRLV':0b000110,
3  'SRAV':0b000111,
4  })

◆ code

miasm.arch.mips32.arch.code = cpu.bs(l=20, cls=(mips32_u16imm,))

◆ console_handler

miasm.arch.mips32.arch.console_handler = logging.StreamHandler()

◆ cpr

miasm.arch.mips32.arch.cpr = cpu.bs(l=3, cls=(mips32_cpr,))

◆ cpr0

miasm.arch.mips32.arch.cpr0 = cpu.bs(l=5, cls=(mips32_imm,), fname="cpr0")

◆ deref

tuple miasm.arch.mips32.arch.deref = deref_off | deref_nooff

◆ deref_nooff

tuple miasm.arch.mips32.arch.deref_nooff = (LPARENTHESIS + gpregs.parser + RPARENTHESIS).setParseAction(cb_deref_nooff)

◆ deref_off

tuple miasm.arch.mips32.arch.deref_off = (Optional(base_expr) + LPARENTHESIS + gpregs.parser + RPARENTHESIS).setParseAction(cb_deref)

◆ epos

miasm.arch.mips32.arch.epos
Initial value:
1 = cpu.bs(l=5, cls=(mips32_u16imm,), fname="epos",
2  order=-1)

◆ eposh

miasm.arch.mips32.arch.eposh = cpu.bs(l=5, cls=(mips32_eposh,))

◆ esize

miasm.arch.mips32.arch.esize = cpu.bs(l=5, cls=(mips32_esize,))

◆ fcc

miasm.arch.mips32.arch.fcc = cpu.bs(l=3, cls=(mips32_fccreg,))

◆ fd

miasm.arch.mips32.arch.fd = cpu.bs(l=5, cls=(mips32_fltpreg,))

◆ fs

miasm.arch.mips32.arch.fs = cpu.bs(l=5, cls=(mips32_fltpreg,))

◆ ft

miasm.arch.mips32.arch.ft = cpu.bs(l=5, cls=(mips32_fltpreg,))

◆ gpregs

miasm.arch.mips32.arch.gpregs = cpu.reg_info(regs.regs32_str, regs.regs32_expr)

◆ hint

miasm.arch.mips32.arch.hint = cpu.bs(l=5, default_val="00000")

◆ hint_pref

miasm.arch.mips32.arch.hint_pref = cpu.bs(l=5, cls=(mips32_u16imm,))

◆ instr_index

miasm.arch.mips32.arch.instr_index = cpu.bs(l=26, cls=(mips32_instr_index,))

◆ log

miasm.arch.mips32.arch.log = logging.getLogger("mips32dis")

◆ LPARENTHESIS

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

◆ oper

miasm.arch.mips32.arch.oper = cpu.bs(l=5, cls=(mips32_u16imm,))

◆ rd

miasm.arch.mips32.arch.rd = cpu.bs(l=5, cls=(mips32_gpreg,))

◆ RPARENTHESIS

miasm.arch.mips32.arch.RPARENTHESIS = Literal(")")

◆ rs

miasm.arch.mips32.arch.rs = cpu.bs(l=5, cls=(mips32_gpreg,))

◆ rt

miasm.arch.mips32.arch.rt = cpu.bs(l=5, cls=(mips32_gpreg,))

◆ s09imm

miasm.arch.mips32.arch.s09imm = cpu.bs(l=9, cls=(mips32_s09imm,))

◆ s09imm_noarg

miasm.arch.mips32.arch.s09imm_noarg
Initial value:
1 = cpu.bs(l=9, cls=(mips32_s09imm_noarg,), fname="imm",
2  order=-1)

◆ s16imm

miasm.arch.mips32.arch.s16imm = cpu.bs(l=16, cls=(mips32_s16imm,))

◆ s16imm_noarg

miasm.arch.mips32.arch.s16imm_noarg
Initial value:
1 = cpu.bs(l=16, cls=(mips32_s16imm_noarg,), fname="imm",
2  order=-1)

◆ sa

miasm.arch.mips32.arch.sa = cpu.bs(l=5, cls=(mips32_u16imm,))

◆ sel

miasm.arch.mips32.arch.sel = cpu.bs(l=3, cls=(mips32_u16imm,))

◆ soff

miasm.arch.mips32.arch.soff = cpu.bs(l=16, cls=(mips32_soff,))

◆ stype

miasm.arch.mips32.arch.stype = cpu.bs(l=5, cls=(mips32_u16imm,))

◆ u16imm

miasm.arch.mips32.arch.u16imm = cpu.bs(l=16, cls=(mips32_u16imm,))