Ejemplo n.º 1
0
Archivo: sem.py Proyecto: vardyh/miasm
def bc1t(ir, instr, a, b):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    dst_o = ExprCond(a, b, n)
    e = [ExprAff(PC, dst_o)]
    e.append(ExprAff(ir.IRDst, dst_o))
    return e, []
Ejemplo n.º 2
0
Archivo: sem.py Proyecto: vardyh/miasm
def bgtz(ir, instr, a, b):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    cond = ExprCond(a, ExprInt1(1), ExprInt1(0)) | a.msb()
    dst_o = ExprCond(cond, n, b)
    e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o)]
    return e, []
Ejemplo n.º 3
0
Archivo: sem.py Proyecto: vardyh/miasm
def jalr(ir, instr, a, b):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    e.append(ExprAff(PC, a))
    e.append(ExprAff(ir.IRDst, a))
    e.append(ExprAff(b, n))
    return e, []
Ejemplo n.º 4
0
def jalr(ir, instr, a, b):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    e.append(ExprAff(PC, a))
    e.append(ExprAff(ir.IRDst, a))
    e.append(ExprAff(b, n))
    return e, []
Ejemplo n.º 5
0
def bc1f(ir, instr, a, b):
    e = []
    n = m2_expr.ExprId(ir.get_next_break_label(instr))
    dst_o = m2_expr.ExprCond(a, n, b)
    e = [m2_expr.ExprAff(PC, dst_o)]
    e.append(m2_expr.ExprAff(ir.IRDst, dst_o))
    return e, []
Ejemplo n.º 6
0
def bc1t(ir, instr, a, b):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    dst_o = ExprCond(a, b, n)
    e = [ExprAff(PC, dst_o)]
    e.append(ExprAff(ir.IRDst, dst_o))
    return e, []
Ejemplo n.º 7
0
def bal(ir, instr, a):
    e = []
    n = m2_expr.ExprId(ir.get_next_break_label(instr))
    e.append(m2_expr.ExprAff(PC, a))
    e.append(m2_expr.ExprAff(ir.IRDst, a))
    e.append(m2_expr.ExprAff(RA, n))
    return e, []
Ejemplo n.º 8
0
def bgez(ir, instr, a, b):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    dst_o = ExprCond(a.msb(), n, b)
    e = [ExprAff(PC, dst_o),
         ExprAff(ir.IRDst, dst_o)
     ]
    return e, []
Ejemplo n.º 9
0
def bne(ir, instr, a, b, c):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    dst_o = ExprCond(a-b, c, n)
    e = [ExprAff(PC, dst_o),
         ExprAff(ir.IRDst, dst_o)
    ]
    return e, []
Ejemplo n.º 10
0
def jal(ir, instr, a):
    "Jumps to the calculated address @a and stores the return address in $RA"
    e = []
    n = m2_expr.ExprId(ir.get_next_break_label(instr))
    e.append(m2_expr.ExprAff(PC, a))
    e.append(m2_expr.ExprAff(ir.IRDst, a))
    e.append(m2_expr.ExprAff(RA, n))
    return e, []
Ejemplo n.º 11
0
def bgtz(ir, instr, a, b):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    cond = ExprCond(a, ExprInt1(1), ExprInt1(0)) | a.msb()
    dst_o = ExprCond(cond, n, b)
    e = [ExprAff(PC, dst_o),
         ExprAff(ir.IRDst, dst_o)
     ]
    return e, []
Ejemplo n.º 12
0
def bltz(ir, instr, a, b):
    """Branches on @b if the register @a is less than zero"""
    e = []
    n = m2_expr.ExprId(ir.get_next_break_label(instr))
    dst_o = m2_expr.ExprCond(a.msb(), b, n)
    e = [m2_expr.ExprAff(PC, dst_o),
         m2_expr.ExprAff(ir.IRDst, dst_o)
    ]
    return e, []
Ejemplo n.º 13
0
def jalr(ir, instr, a, b):
    """Jump to an address stored in a register @a, and store the return address
    in another register @b"""
    e = []
    n = m2_expr.ExprId(ir.get_next_break_label(instr))
    e.append(m2_expr.ExprAff(PC, a))
    e.append(m2_expr.ExprAff(ir.IRDst, a))
    e.append(m2_expr.ExprAff(b, n))
    return e, []
Ejemplo n.º 14
0
def beq(ir, instr, a, b, c):
    "Branches on @c if the quantities of two registers @a, @b are equal"
    e = []
    n = m2_expr.ExprId(ir.get_next_break_label(instr))
    dst_o = m2_expr.ExprCond(a-b, n, c)
    e = [m2_expr.ExprAff(PC, dst_o),
         m2_expr.ExprAff(ir.IRDst, dst_o)
     ]
    return e, []
Ejemplo n.º 15
0
def bgez(ir, instr, a, b):
    """Branches on @b if the quantities of register @a is greater than or equal
    to zero"""
    e = []
    n = m2_expr.ExprId(ir.get_next_break_label(instr))
    dst_o = m2_expr.ExprCond(a.msb(), n, b)
    e = [m2_expr.ExprAff(PC, dst_o),
         m2_expr.ExprAff(ir.IRDst, dst_o)
     ]
    return e, []
Ejemplo n.º 16
0
def bgtz(ir, instr, a, b):
    """Branches on @b if the register @a is greater than zero"""
    e = []
    n = m2_expr.ExprId(ir.get_next_break_label(instr))
    cond = m2_expr.ExprCond(a, m2_expr.ExprInt1(1),
                            m2_expr.ExprInt1(0)) | a.msb()
    dst_o = m2_expr.ExprCond(cond, n, b)
    e = [m2_expr.ExprAff(PC, dst_o),
         m2_expr.ExprAff(ir.IRDst, dst_o)
     ]
    return e, []
Ejemplo n.º 17
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def beq(arg1, arg2, arg3):
    "Branches on @arg3 if the quantities of two registers @arg1, @arg2 are eq"
    dst = ExprId(ir.get_next_break_label(instr)) if arg1 - arg2 else arg3
    PC = dst
    ir.IRDst = dst
Ejemplo n.º 18
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def bgez(arg1, arg2):
    """Branches on @arg2 if the quantities of register @arg1 is greater than or
    equal to zero"""
    dst = ExprId(ir.get_next_break_label(instr)) if arg1.msb() else arg2
    PC = dst
    ir.IRDst = dst
Ejemplo n.º 19
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def bne(arg1, arg2, arg3):
    """Branches on @arg3 if the quantities of two registers @arg1, @arg2 are NOT
    equal"""
    dst = arg3 if arg1 - arg2 else ExprId(ir.get_next_break_label(instr))
    PC = dst
    ir.IRDst = dst
Ejemplo n.º 20
0
def bltz(arg1, arg2):
    """Branches on @arg2 if the register @arg1 is less than zero"""
    dst_o = arg2 if arg1.msb() else ExprId(ir.get_next_break_label(instr))
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 21
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def bgtz(arg1, arg2):
    """Branches on @arg2 if the register @arg1 is greater than zero"""
    cond = (i1(1) if arg1 else i1(0)) | arg1.msb()
    dst_o = ExprId(ir.get_next_break_label(instr)) if cond else arg2
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 22
0
def bc1f(arg1, arg2):
    dst_o = ExprId(ir.get_next_break_label(instr)) if arg1 else arg2
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 23
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def bc1f(arg1, arg2):
    dst_o = ExprId(ir.get_next_break_label(instr)) if arg1 else arg2
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 24
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def blez(arg1, arg2):
    """Branches on @arg2 if the register @arg1 is less than or equal to zero"""
    cond = (i1(1) if arg1 else i1(0)) | arg1.msb()
    dst_o = arg2 if cond else ExprId(ir.get_next_break_label(instr))
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 25
0
def bc1t(arg1, arg2):
    dst_o = arg2 if arg1 else ExprId(ir.get_next_break_label(instr))
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 26
0
Archivo: sem.py Proyecto: vardyh/miasm
def bgez(ir, instr, a, b):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    dst_o = ExprCond(a.msb(), n, b)
    e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o)]
    return e, []
Ejemplo n.º 27
0
def bgtz(arg1, arg2):
    """Branches on @arg2 if the register @arg1 is greater than zero"""
    cond = (i1(1) if arg1 else i1(0)) | arg1.msb()
    dst_o = ExprId(ir.get_next_break_label(instr)) if cond else arg2
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 28
0
def blez(arg1, arg2):
    """Branches on @arg2 if the register @arg1 is less than or equal to zero"""
    cond = (i1(1) if arg1 else i1(0)) | arg1.msb()
    dst_o = arg2 if cond else ExprId(ir.get_next_break_label(instr))
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 29
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def bal(arg1):
    PC = arg1
    ir.IRDst = arg1
    RA = ExprId(ir.get_next_break_label(instr))
Ejemplo n.º 30
0
def bal(arg1):
    PC = arg1
    ir.IRDst = arg1
    RA = ExprId(ir.get_next_break_label(instr))
Ejemplo n.º 31
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def jalr(arg1, arg2):
    """Jump to an address stored in a register @arg1, and store the return
    address in another register @arg2"""
    PC = arg1
    ir.IRDst = arg1
    arg2 = ExprId(ir.get_next_break_label(instr))
Ejemplo n.º 32
0
def beq(arg1, arg2, arg3):
    "Branches on @arg3 if the quantities of two registers @arg1, @arg2 are eq"
    dst = ExprId(ir.get_next_break_label(instr)) if arg1 - arg2 else arg3
    PC = dst
    ir.IRDst = dst
Ejemplo n.º 33
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def bc1t(arg1, arg2):
    dst_o = arg2 if arg1 else ExprId(ir.get_next_break_label(instr))
    PC = dst_o
    ir.IRDst = dst_o
Ejemplo n.º 34
0
def bgez(arg1, arg2):
    """Branches on @arg2 if the quantities of register @arg1 is greater than or
    equal to zero"""
    dst = ExprId(ir.get_next_break_label(instr)) if arg1.msb() else arg2
    PC = dst
    ir.IRDst = dst
Ejemplo n.º 35
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def jal(arg1):
    "Jumps to the calculated address @arg1 and stores the return address in $RA"
    PC = arg1
    ir.IRDst = arg1
    RA = ExprId(ir.get_next_break_label(instr))
Ejemplo n.º 36
0
def bne(arg1, arg2, arg3):
    """Branches on @arg3 if the quantities of two registers @arg1, @arg2 are NOT
    equal"""
    dst = arg3 if arg1 - arg2 else ExprId(ir.get_next_break_label(instr))
    PC = dst
    ir.IRDst = dst
Ejemplo n.º 37
0
def jal(arg1):
    "Jumps to the calculated address @arg1 and stores the return address in $RA"
    PC = arg1
    ir.IRDst = arg1
    RA = ExprId(ir.get_next_break_label(instr))
Ejemplo n.º 38
0
Archivo: sem.py Proyecto: vardyh/miasm
def bne(ir, instr, a, b, c):
    e = []
    n = ExprId(ir.get_next_break_label(instr))
    dst_o = ExprCond(a - b, c, n)
    e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o)]
    return e, []
Ejemplo n.º 39
0
def jalr(arg1, arg2):
    """Jump to an address stored in a register @arg1, and store the return
    address in another register @arg2"""
    PC = arg1
    ir.IRDst = arg1
    arg2 = ExprId(ir.get_next_break_label(instr))
Ejemplo n.º 40
0
Archivo: sem.py Proyecto: 0xf1sh/miasm
def bltz(arg1, arg2):
    """Branches on @arg2 if the register @arg1 is less than zero"""
    dst_o = arg2 if arg1.msb() else ExprId(ir.get_next_break_label(instr))
    PC = dst_o
    ir.IRDst = dst_o