コード例 #1
0
ファイル: superh.py プロジェクト: mothran/binaryninja_superh
    def lift_tst(il: LowLevelILFunction, insn: SHInsn):
        assert len(insn.opcode["args"]
                   ) == 2, f"Invalid instruction at: 0x{insn.addr:x}"

        op_1 = insn.opcode["args"][0]
        op_2 = insn.opcode["args"][1]

        t = LowLevelILLabel()
        f = LowLevelILLabel()
        next_insn = LowLevelILLabel()

        il.append(
            il.if_expr(
                il.compare_equal(
                    RSIZE,
                    il.and_expr(RSIZE, Lifter._lift_op(il, insn, op_1),
                                Lifter._lift_op(il, insn, op_2)),
                    il.const(RSIZE, 0)), t, f))

        il.mark_label(t)
        il.append(il.set_flag('t', il.const(0, 1)))
        il.append(il.goto(next_insn))

        il.mark_label(f)
        il.append(il.set_flag('t', il.const(0, 0)))

        il.mark_label(next_insn)
コード例 #2
0
ファイル: superh.py プロジェクト: mothran/binaryninja_superh
    def lift_cmp_eq(il: LowLevelILFunction, insn: SHInsn):
        assert len(insn.opcode["args"]
                   ) == 2, f"Invalid instruction at: 0x{insn.addr:x}"

        op_1 = insn.opcode["args"][0]
        op_2 = insn.opcode["args"][1]

        extend = False
        if op_1.type == OpType.IMM:
            extend = True

        t = LowLevelILLabel()
        f = LowLevelILLabel()
        next_insn = LowLevelILLabel()

        il.append(
            il.if_expr(
                il.compare_equal(
                    RSIZE, Lifter._lift_op(il, insn, op_1, sign_ext=extend),
                    Lifter._lift_op(il, insn, op_2)), t, f))

        il.mark_label(t)
        il.append(il.set_flag('t', il.const(0, 1)))
        il.append(il.goto(next_insn))

        il.mark_label(f)
        il.append(il.set_flag('t', il.const(0, 0)))

        il.mark_label(next_insn)