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

Classes

class  additional_info
 
class  bs_mod_name_prio4
 
class  bs_mod_name_prio5
 
class  bs_mod_name_prio6
 
class  instruction_ppc
 
class  mn_ppc
 
class  ppc_arg
 
class  ppc_crfreg
 
class  ppc_crfreg_noarg
 
class  ppc_deref32
 
class  ppc_divert_conditional_branch
 
class  ppc_float
 
class  ppc_gpreg
 
class  ppc_gpreg_noarg
 
class  ppc_gpreg_or_0
 
class  ppc_gpreg_or_0_noarg
 
class  ppc_imm
 
class  ppc_reg
 
class  ppc_s14imm_branch
 
class  ppc_s16imm
 
class  ppc_s24imm_branch
 
class  ppc_spr
 
class  ppc_tbr
 
class  ppc_u02imm_noarg
 
class  ppc_u04imm
 
class  ppc_u05imm
 
class  ppc_u08imm
 
class  ppc_u16imm
 
class  ppc_vex
 

Functions

def cb_deref_imm_reg (tokens)
 
def ppc_swap_10 (v)
 
def ppc_bo_bi_to_mnemo (bo, bi, prefer_taken=True, default_taken=True)
 
def ppc_all_bo_bi ()
 
def ppcop (name, fields, args=None, alias=False)
 

Variables

 log = logging.getLogger("ppcdis")
 
 console_handler = logging.StreamHandler()
 
 LPARENTHESIS = Suppress(Literal("("))
 
 RPARENTHESIS = Suppress(Literal(")"))
 
tuple deref_reg_disp = (Optional(base_expr) + LPARENTHESIS + gpregs.parser + RPARENTHESIS).setParseAction(cb_deref_imm_reg)
 
tuple deref_reg = (LPARENTHESIS + gpregs.parser + RPARENTHESIS).setParseAction(cb_deref_imm_reg)
 
tuple deref = deref_reg | deref_reg_disp
 
 rd = bs(l=5, cls=(ppc_gpreg,))
 
 ra = bs(l=5, cls=(ppc_gpreg,))
 
 ra_or_0 = bs(l=5, cls=(ppc_gpreg_or_0,))
 
 rb = bs(l=5, cls=(ppc_gpreg,))
 
 rs = bs(l=5, cls=(ppc_gpreg,))
 
 crfd = bs(l=3, cls=(ppc_crfreg,))
 
 crfs = bs(l=3, cls=(ppc_crfreg,))
 
 sh = bs(l=5, cls=(ppc_u05imm,))
 
 mb = bs(l=5, cls=(ppc_u05imm,))
 
 me = bs(l=5, cls=(ppc_u05imm,))
 
 nb = bs(l=5, cls=(ppc_u05imm,))
 
 crm = bs(l=8, cls=(ppc_u08imm,))
 
 sr = bs(l=4, cls=(ppc_u04imm,))
 
 spr = bs(l=10, cls=(ppc_spr,))
 
 tbr = bs(l=10, cls=(ppc_tbr,))
 
 u05imm = bs(l=5, cls=(ppc_u05imm,))
 
 s24imm_branch = bs(l=24, cls=(ppc_s24imm_branch,), fname="imm")
 
 s14imm_branch = bs(l=14, cls=(ppc_s14imm_branch,), fname="imm")
 
 s16imm = bs(l=16, cls=(ppc_s16imm,), fname="imm")
 
 u16imm = bs(l=16, cls=(ppc_u16imm,), fname="imm")
 
 u08imm = bs(l=5, cls=(ppc_u08imm,), fname="imm")
 
 u02imm_noarg = bs(l=2, cls=(ppc_u02imm_noarg,), fname="imm")
 
 ra_noarg = bs(l=5, cls=(ppc_gpreg_noarg,), fname="ra")
 
 ra_or_0_noarg = bs(l=5, cls=(ppc_gpreg_or_0_noarg,), fname="ra")
 
 dregimm = bs(l=16, cls=(ppc_deref32,))
 
 rc_mod = bs_mod_name(l=1, mn_mod=['', '.'], fname='rc')
 
 frd = bs(l=5, cls=(ppc_float,))
 
 frb = bs(l=5, cls=(ppc_float,))
 
 frs = bs(l=5, cls=(ppc_float,))
 
 fm = bs(l=8, cls=(ppc_u08imm,))
 
 va = bs(l=5, cls=(ppc_vex,))
 
 vb = bs(l=5, cls=(ppc_vex,))
 
 vd = bs(l=5, cls=(ppc_vex,))
 
 rb_noarg = bs(l=5, cls=(ppc_gpreg_noarg,), fname="rb")
 
dictionary arith1_name
 
dictionary logic2_name = {"ORI": 0b011000, "XORI": 0b011010, "ANDI.": 0b011100 }
 
dictionary slogic2_name = {"ORIS": 0b011001, "XORIS": 0b011011, "ANDIS.": 0b011101 }
 
dictionary arith3_name
 
dictionary xor_name = { "EQV": 0b0100011100, "XOR": 0b0100111100 }
 
dictionary arith4_name
 
dictionary arith5_name = {"CNTLZW": 0b00000, "EXTSH": 0b11100, "EXTSB": 0b11101 }
 
dictionary crlogic_name
 
dictionary rotins_name = {"RLWIMI": 0b010100, "RLWINM": 0b010101 }
 
 bs_arith1_name = bs_name(l=6, name=arith1_name)
 
dictionary load1_name
 
dictionary load1_name_u
 
dictionary load2_name
 
dictionary load2_name_u = {"LWZU": 0b0001, "LBZU": 0b0011, "LHZU": 0b1001, "LHAU": 0b1011}
 
dictionary store1_name
 
dictionary store1_name_u
 
dictionary store2_name = { "STW": 0b0100, "STB": 0b0110, "STH": 0b1100, "STMW": 0b1111 }
 
dictionary store2_name_u = { "STWU": 0b0101, "STBU": 0b0111, "STHU": 0b1101 }
 
dictionary logic1_name
 
dictionary dcb_name
 
dictionary load1_name_float = {"LFS": 0b110000, "LFD": 0b110010 }
 
dictionary load1_name_float_u = {"LFSU": 0b110001, "LFDU": 0b110011 }
 
dictionary store1_name_float = {"STFS": 0b110100, "STFD": 0b110110 }
 
dictionary store1_name_float_u = {"STFSU": 0b110101, "STFDU": 0b110111 }
 
dictionary load1_name_vex
 
 branch_to_reg = bs_mod_name_prio4(l=1, mn_mod=['LR', 'CTR'], fname='btoreg')
 
 branch_lk = bs_mod_name_prio5(l=1, mn_mod=['', 'L'], fname='lk')
 
 branch_aa = bs_mod_name_prio6(l=1, mn_mod=['', 'A'], fname='aa')
 

Function Documentation

◆ cb_deref_imm_reg()

def miasm.arch.ppc.arch.cb_deref_imm_reg (   tokens)

◆ ppc_all_bo_bi()

def miasm.arch.ppc.arch.ppc_all_bo_bi ( )
Here is the caller graph for this function:

◆ ppc_bo_bi_to_mnemo()

def miasm.arch.ppc.arch.ppc_bo_bi_to_mnemo (   bo,
  bi,
  prefer_taken = True,
  default_taken = True 
)
Here is the caller graph for this function:

◆ ppc_swap_10()

def miasm.arch.ppc.arch.ppc_swap_10 (   v)

◆ ppcop()

def miasm.arch.ppc.arch.ppcop (   name,
  fields,
  args = None,
  alias = False 
)

Variable Documentation

◆ arith1_name

dictionary miasm.arch.ppc.arch.arith1_name
Initial value:
1 = {"MULLI": 0b000111, "SUBFIC": 0b001000, "ADDIC": 0b001100,
2  "ADDIC.": 0b001101 }

◆ arith3_name

dictionary miasm.arch.ppc.arch.arith3_name
Initial value:
1 = {"SUBFC": 0b0000001000, "ADDC": 0b0000001010,
2  "MULHWU": 0b0000001011, "SUBF": 0b0000101000,
3  "MULHW": 0b0001001011, "SUBFE": 0b0010001000,
4  "ADDE": 0b0010001010, "MULLW": 0b0011101011,
5  "ADD": 0b0100001010, "DIVWU": 0b0111001011,
6  "DIVW": 0b0111101011, "SUBFCO": 0b1000001000,
7  "ADDCO": 0b1000001010, "SUBFO": 0b1000101000,
8  "SUBFEO": 0b1010001000, "ADDEO": 0b1010001010,
9  "MULLWO": 0b1011101011, "ADDO": 0b1100001010,
10  "DIVWUO": 0b1111001011, "DIVWO": 0b1111101011 }

◆ arith4_name

dictionary miasm.arch.ppc.arch.arith4_name
Initial value:
1 = {"NEG": 0b0001101000, "SUBFZE": 0b0011001000,
2  "ADDZE": 0b0011001010, "SUBFME": 0b0011101000,
3  "ADDME": 0b0011101010, "NEGO": 0b1001101000,
4  "SUBFZEO": 0b1011001000, "ADDZEO": 0b1011001010,
5  "SUBFMEO": 0b1011101000, "ADDMEO": 0b1011101010 }

◆ arith5_name

dictionary miasm.arch.ppc.arch.arith5_name = {"CNTLZW": 0b00000, "EXTSH": 0b11100, "EXTSB": 0b11101 }

◆ branch_aa

miasm.arch.ppc.arch.branch_aa = bs_mod_name_prio6(l=1, mn_mod=['', 'A'], fname='aa')

◆ branch_lk

miasm.arch.ppc.arch.branch_lk = bs_mod_name_prio5(l=1, mn_mod=['', 'L'], fname='lk')

◆ branch_to_reg

miasm.arch.ppc.arch.branch_to_reg = bs_mod_name_prio4(l=1, mn_mod=['LR', 'CTR'], fname='btoreg')

◆ bs_arith1_name

miasm.arch.ppc.arch.bs_arith1_name = bs_name(l=6, name=arith1_name)

◆ console_handler

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

◆ crfd

miasm.arch.ppc.arch.crfd = bs(l=3, cls=(ppc_crfreg,))

◆ crfs

miasm.arch.ppc.arch.crfs = bs(l=3, cls=(ppc_crfreg,))

◆ crlogic_name

dictionary miasm.arch.ppc.arch.crlogic_name
Initial value:
1 = {"CRAND": 0b1000, "CRANDC": 0b0100, "CREQV": 0b1001,
2  "CRNAND": 0b0111, "CRNOR": 0b0001, "CROR": 0b1110,
3  "CRORC": 0b1101, "CRXOR": 0b0110 }

◆ crm

miasm.arch.ppc.arch.crm = bs(l=8, cls=(ppc_u08imm,))

◆ dcb_name

dictionary miasm.arch.ppc.arch.dcb_name
Initial value:
1 = {"DCBST": 0b00001, "DCBF": 0b00010,
2  "DCBTST": 0b00111, "DCBT": 0b01000,
3  "DCBI": 0b01110, "DCBA": 0b10111,
4  "ICBI": 0b11110, "DCBZ": 0b11111 }

◆ deref

tuple miasm.arch.ppc.arch.deref = deref_reg | deref_reg_disp

◆ deref_reg

tuple miasm.arch.ppc.arch.deref_reg = (LPARENTHESIS + gpregs.parser + RPARENTHESIS).setParseAction(cb_deref_imm_reg)

◆ deref_reg_disp

tuple miasm.arch.ppc.arch.deref_reg_disp = (Optional(base_expr) + LPARENTHESIS + gpregs.parser + RPARENTHESIS).setParseAction(cb_deref_imm_reg)

◆ dregimm

miasm.arch.ppc.arch.dregimm = bs(l=16, cls=(ppc_deref32,))

◆ fm

miasm.arch.ppc.arch.fm = bs(l=8, cls=(ppc_u08imm,))

◆ frb

miasm.arch.ppc.arch.frb = bs(l=5, cls=(ppc_float,))

◆ frd

miasm.arch.ppc.arch.frd = bs(l=5, cls=(ppc_float,))

◆ frs

miasm.arch.ppc.arch.frs = bs(l=5, cls=(ppc_float,))

◆ load1_name

dictionary miasm.arch.ppc.arch.load1_name
Initial value:
1 = {"LWARX": 0b0000010100, "LWZX": 0b0000010111,
2  "LBZX": 0b0001010111, "LHZX": 0b0100010111,
3  "ECIWX": 0b0100110110, "LHAX": 0b0101010111,
4  "LSWX": 0b1000010101, "LWBRX": 0b1000010110,
5  "LHBRX": 0b1100010110 }

◆ load1_name_float

dictionary miasm.arch.ppc.arch.load1_name_float = {"LFS": 0b110000, "LFD": 0b110010 }

◆ load1_name_float_u

dictionary miasm.arch.ppc.arch.load1_name_float_u = {"LFSU": 0b110001, "LFDU": 0b110011 }

◆ load1_name_u

dictionary miasm.arch.ppc.arch.load1_name_u
Initial value:
1 = {"LWZUX": 0b0000110111, "LBZUX": 0b0001110111,
2  "LHZUX": 0b0100110111, "LHAUX": 0b0101110111 }

◆ load1_name_vex

dictionary miasm.arch.ppc.arch.load1_name_vex
Initial value:
1 = {"LVEBX": 0b0000000111, "LVEHX": 0b0000100111,
2  "LVEWX": 0b0001000111, "LVSL": 0b0000000110,
3  "LVSR": 0b0000100110, "LVX": 0b0001100111,
4  "LVXL": 0b0101100111 }

◆ load2_name

dictionary miasm.arch.ppc.arch.load2_name
Initial value:
1 = {"LWZ": 0b0000, "LBZ": 0b0010, "LHZ": 0b1000, "LHA": 0b1010,
2  "LMW": 0b1110 }

◆ load2_name_u

dictionary miasm.arch.ppc.arch.load2_name_u = {"LWZU": 0b0001, "LBZU": 0b0011, "LHZU": 0b1001, "LHAU": 0b1011}

◆ log

miasm.arch.ppc.arch.log = logging.getLogger("ppcdis")

◆ logic1_name

dictionary miasm.arch.ppc.arch.logic1_name
Initial value:
1 = {"SLW": 0b0000011000, "AND": 0b0000011100,
2  "ANDC": 0b0000111100, "NOR": 0b0001111100,
3  "ORC": 0b0110011100, "OR": 0b0110111100,
4  "NAND": 0b0111011100, "SRW": 0b1000011000,
5  "SRAW": 0b1100011000 }

◆ logic2_name

dictionary miasm.arch.ppc.arch.logic2_name = {"ORI": 0b011000, "XORI": 0b011010, "ANDI.": 0b011100 }

◆ LPARENTHESIS

miasm.arch.ppc.arch.LPARENTHESIS = Suppress(Literal("("))

◆ mb

miasm.arch.ppc.arch.mb = bs(l=5, cls=(ppc_u05imm,))

◆ me

miasm.arch.ppc.arch.me = bs(l=5, cls=(ppc_u05imm,))

◆ nb

miasm.arch.ppc.arch.nb = bs(l=5, cls=(ppc_u05imm,))

◆ ra

miasm.arch.ppc.arch.ra = bs(l=5, cls=(ppc_gpreg,))

◆ ra_noarg

miasm.arch.ppc.arch.ra_noarg = bs(l=5, cls=(ppc_gpreg_noarg,), fname="ra")

◆ ra_or_0

miasm.arch.ppc.arch.ra_or_0 = bs(l=5, cls=(ppc_gpreg_or_0,))

◆ ra_or_0_noarg

miasm.arch.ppc.arch.ra_or_0_noarg = bs(l=5, cls=(ppc_gpreg_or_0_noarg,), fname="ra")

◆ rb

miasm.arch.ppc.arch.rb = bs(l=5, cls=(ppc_gpreg,))

◆ rb_noarg

miasm.arch.ppc.arch.rb_noarg = bs(l=5, cls=(ppc_gpreg_noarg,), fname="rb")

◆ rc_mod

miasm.arch.ppc.arch.rc_mod = bs_mod_name(l=1, mn_mod=['', '.'], fname='rc')

◆ rd

miasm.arch.ppc.arch.rd = bs(l=5, cls=(ppc_gpreg,))

◆ rotins_name

dictionary miasm.arch.ppc.arch.rotins_name = {"RLWIMI": 0b010100, "RLWINM": 0b010101 }

◆ RPARENTHESIS

miasm.arch.ppc.arch.RPARENTHESIS = Suppress(Literal(")"))

◆ rs

miasm.arch.ppc.arch.rs = bs(l=5, cls=(ppc_gpreg,))

◆ s14imm_branch

miasm.arch.ppc.arch.s14imm_branch = bs(l=14, cls=(ppc_s14imm_branch,), fname="imm")

◆ s16imm

miasm.arch.ppc.arch.s16imm = bs(l=16, cls=(ppc_s16imm,), fname="imm")

◆ s24imm_branch

miasm.arch.ppc.arch.s24imm_branch = bs(l=24, cls=(ppc_s24imm_branch,), fname="imm")

◆ sh

miasm.arch.ppc.arch.sh = bs(l=5, cls=(ppc_u05imm,))

◆ slogic2_name

dictionary miasm.arch.ppc.arch.slogic2_name = {"ORIS": 0b011001, "XORIS": 0b011011, "ANDIS.": 0b011101 }

◆ spr

miasm.arch.ppc.arch.spr = bs(l=10, cls=(ppc_spr,))

◆ sr

miasm.arch.ppc.arch.sr = bs(l=4, cls=(ppc_u04imm,))

◆ store1_name

dictionary miasm.arch.ppc.arch.store1_name
Initial value:
1 = { "STWCX.": 0b00100101101, "STWX": 0b00100101110,
2  "STBX": 0b00110101110, "STHX": 0b01100101110,
3  "ECOWX": 0b01101101100, "STSWX": 0b10100101010,
4  "STWBRX": 0b10100101100, "STHBRX": 0b11100101100 }

◆ store1_name_float

dictionary miasm.arch.ppc.arch.store1_name_float = {"STFS": 0b110100, "STFD": 0b110110 }

◆ store1_name_float_u

dictionary miasm.arch.ppc.arch.store1_name_float_u = {"STFSU": 0b110101, "STFDU": 0b110111 }

◆ store1_name_u

dictionary miasm.arch.ppc.arch.store1_name_u
Initial value:
1 = { "STWUX": 0b00101101110, "STBUX": 0b00111101110,
2  "STHUX": 0b01101101110 }

◆ store2_name

dictionary miasm.arch.ppc.arch.store2_name = { "STW": 0b0100, "STB": 0b0110, "STH": 0b1100, "STMW": 0b1111 }

◆ store2_name_u

dictionary miasm.arch.ppc.arch.store2_name_u = { "STWU": 0b0101, "STBU": 0b0111, "STHU": 0b1101 }

◆ tbr

miasm.arch.ppc.arch.tbr = bs(l=10, cls=(ppc_tbr,))

◆ u02imm_noarg

miasm.arch.ppc.arch.u02imm_noarg = bs(l=2, cls=(ppc_u02imm_noarg,), fname="imm")

◆ u05imm

miasm.arch.ppc.arch.u05imm = bs(l=5, cls=(ppc_u05imm,))

◆ u08imm

miasm.arch.ppc.arch.u08imm = bs(l=5, cls=(ppc_u08imm,), fname="imm")

◆ u16imm

miasm.arch.ppc.arch.u16imm = bs(l=16, cls=(ppc_u16imm,), fname="imm")

◆ va

miasm.arch.ppc.arch.va = bs(l=5, cls=(ppc_vex,))

◆ vb

miasm.arch.ppc.arch.vb = bs(l=5, cls=(ppc_vex,))

◆ vd

miasm.arch.ppc.arch.vd = bs(l=5, cls=(ppc_vex,))

◆ xor_name

dictionary miasm.arch.ppc.arch.xor_name = { "EQV": 0b0100011100, "XOR": 0b0100111100 }